Browse Source

minor bugfixes to Qt for new wallet code

master
AdamISZ 7 years ago
parent
commit
455d092e3a
No known key found for this signature in database
GPG Key ID: B3AE09F1E9A3197A
  1. 7
      jmclient/jmclient/wallet_utils.py
  2. 11
      scripts/joinmarket-qt.py

7
jmclient/jmclient/wallet_utils.py

@ -884,6 +884,13 @@ def open_test_wallet_maybe(path, seed, max_mixdepth,
test_wallet_cls.initialize(
storage, get_network(), max_mixdepth=max_mixdepth,
entropy=seed)
#wallet instantiation insists on no unexpected kwargs,
#but Qt caller opens both test and mainnet with same args,
#hence these checks/deletes of unwanted args for tests.
if 'ask_for_password' in kwargs:
del kwargs['ask_for_password']
if 'password' in kwargs:
del kwargs['password']
assert 'ask_for_password' not in kwargs
assert 'read_only' not in kwargs
return test_wallet_cls(storage, **kwargs)

11
scripts/joinmarket-qt.py

@ -53,7 +53,7 @@ JM_CORE_VERSION = '0.3.5'
JM_GUI_VERSION = '7'
from jmclient import (
load_program_config, get_network, open_wallet, get_wallet_path,
load_program_config, get_network, open_test_wallet_maybe, get_wallet_path,
get_p2sh_vbyte, get_p2pk_vbyte, jm_single, validate_address, get_log,
weighted_order_choose, Taker, JMClientProtocolFactory, WalletError,
start_reactor, get_schedule, get_tumble_schedule, schedule_to_text,
@ -1058,7 +1058,7 @@ class JMWalletTab(QWidget):
if jm_single().config.get("BLOCKCHAIN", "blockchain_source") == "regtest":
self.wallet_name = self.mainwindow.wallet.seed
else:
self.wallet_name = os.path.basename(self.mainwindow.wallet.path)
self.wallet_name = os.path.basename(self.mainwindow.wallet._storage.path)
self.label1.setText("CURRENT WALLET: " + self.wallet_name +
', total balance: ' + total_bal)
@ -1374,15 +1374,16 @@ class JMMainWindow(QMainWindow):
if (firstarg and pwd) or (firstarg and get_network() == 'testnet'):
wallet_path = get_wallet_path(str(firstarg), None)
try:
self.wallet = open_wallet(
wallet_path, ask_for_password=False, password=pwd,
gap_limit=jm_single().config.getint("GUI", "gaplimit"))
self.wallet = open_test_wallet_maybe(wallet_path, str(firstarg),
4, ask_for_password=False, password=pwd,
gap_limit=jm_single().config.getint("GUI", "gaplimit"))
except Exception as e:
JMQtMessageBox(self,
str(e),
mbtype='warn',
title="Error")
return False
self.wallet.seed = str(firstarg)
if 'listunspent_args' not in jm_single().config.options('POLICY'):
jm_single().config.set('POLICY', 'listunspent_args', '[0]')
assert self.wallet, "No wallet loaded"

Loading…
Cancel
Save