Browse Source

Fix bug in wallet generate in Qt when cancelled

Prior to this commit, if a user chose cancel while selecting a
filename for a new wallet in Qt, the wallet name was set to the
default `wallet.jmdat`, which could lead to a crash or overwrite.
This fixes that by ensuring that the wallet generation code
recognizes the cancel operation.
master
AdamISZ 7 years ago
parent
commit
eaac4be0fc
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 4
      jmclient/jmclient/wallet_utils.py
  2. 4
      scripts/joinmarket-qt.py

4
jmclient/jmclient/wallet_utils.py

@ -523,6 +523,10 @@ def wallet_generate_recover_bip39(method, walletspath, default_wallet_name,
return False
wallet_name = callbacks[3]()
if wallet_name == "cancelled":
# currently used only by Qt, because user has option
# to click cancel in dialog.
return False
if not wallet_name:
wallet_name = default_wallet_name
wallet_path = os.path.join(walletspath, wallet_name)

4
scripts/joinmarket-qt.py

@ -1482,7 +1482,9 @@ class JMMainWindow(QMainWindow):
QLineEdit.Normal, "wallet.jmdat")
if not ok:
JMQtMessageBox(self, "Create wallet aborted", mbtype='warn')
return None
# cannot use None for a 'fail' condition, as this is used
# for the case where the default wallet name is to be used in non-Qt.
return "cancelled"
self.walletname = str(walletname)
return self.walletname

Loading…
Cancel
Save