Skip to content

Commit

Permalink
fix wallet list load for current datadir
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamISZ committed Sep 16, 2021
1 parent 89f9571 commit f8bb12a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions scripts/jmwalletd.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
SNICKERReceiverService, SNICKERReceiver, create_wallet, \
StorageError, StoragePasswordError, get_max_cj_fee_values
from jmbase.support import get_log, set_logging_level, jmprint,EXIT_ARGERROR, EXIT_FAILURE,DUST_THRESHOLD
import glob

import jwt

Expand Down Expand Up @@ -473,17 +472,14 @@ def unlockwallet(self, request, walletname):
#This route should return list of current wallets created.
@app.route('/wallet/all', methods=['GET'])
def listwallets(self, request):
#this is according to the assumption that wallets are there in /.joinmarket by default, also currently path for linux system only.
#first user taken for path
user_path = glob.glob('/home/*/')[0]

wallet_dir = f"{user_path}.joinmarket/wallets/*.jmdat"
wallets = (glob.glob(wallet_dir))

offset = len(user_path)+len('.joinmarket/wallets/')
#to get only names
short_wallets = [wallet[offset:] for wallet in wallets]
return response(request,wallets=short_wallets)
wallet_dir = os.path.join(jm_single().datadir, 'wallets')
# TODO: we allow any file name; .jmdat is only
# a convention; but this means we should validate these
# wallet files before returning them (though JM itself
# never puts any other kind of file in this directory,
# the user conceivably might).
wallets = os.listdir(wallet_dir)

This comment has been minimized.

Copy link
@abhishek0405

abhishek0405 Sep 16, 2021

Owner

I think we should add a filter to show only .jmdat files else the .lock files also get displayed.

This comment has been minimized.

Copy link
@AdamISZ

AdamISZ Sep 17, 2021

Author

Yes, error here, sorry, see JoinMarket-Org/jm-web-client#8 (comment)

This comment has been minimized.

Copy link
@AdamISZ

AdamISZ Sep 17, 2021

Author

Fixed in a1dfe34

return response(request, wallets=wallets)

#route to get external address for deposit
@app.route('/address/new/<string:mixdepth>',methods=['GET'])
Expand Down

0 comments on commit f8bb12a

Please sign in to comment.