Browse Source

handle Qt wallet load failure

master
Adam Gibson 5 years ago
parent
commit
5af2d49a8a
No known key found for this signature in database
GPG Key ID: 141001A1AF77F20B
  1. 3
      jmbase/jmbase/twisted_utils.py
  2. 7
      jmclient/jmclient/wallet_service.py
  3. 9
      scripts/joinmarket-qt.py

3
jmbase/jmbase/twisted_utils.py

@ -11,7 +11,6 @@ def stop_reactor():
raised by trying to stop the reactor.
"""
try:
if reactor.running:
reactor.stop()
reactor.stop()
except ReactorNotRunning:
pass

7
jmclient/jmclient/wallet_service.py

@ -47,9 +47,13 @@ class WalletService(Service):
self.wallet = wallet
self.synced = False
# used to flag RPC failure at construction of object:
self.rpc_error = False
# keep track of the quasi-real-time blockheight
# (updated in main monitor loop)
self.current_blockheight = None
if self.bci is not None:
if not self.update_blockheight():
# this accounts for the unusual case
@ -60,6 +64,9 @@ class WalletService(Service):
jlog.error("Failure of RPC connection to Bitcoin Core in "
"wallet service startup. Application cannot "
"continue, shutting down.")
self.rpc_error = ("Failure of RPC connection to Bitcoin "
"Core in wallet service startup.")
# no need to call stopService as it has not yet been started.
stop_reactor()
else:
jlog.warning("No blockchain source available, " +

9
scripts/joinmarket-qt.py

@ -1844,6 +1844,10 @@ class JMMainWindow(QMainWindow):
mbtype='warn',
title="Error")
return
if decrypted == "error":
# special case, not a failure to decrypt the file but
# a failure of wallet loading, give up:
self.close()
else:
if not testnet_seed:
testnet_seed, ok = QInputDialog.getText(self,
@ -1887,6 +1891,11 @@ class JMMainWindow(QMainWindow):
self.walletRefresh.stop()
self.wallet_service = WalletService(wallet)
# in case an RPC error occurs in the constructor:
if self.wallet_service.rpc_error:
JMQtMessageBox(self,self.wallet_service.rpc_error,
mbtype='warn',title="Error")
return "error"
if jm_single().bc_interface is None:
self.centralWidget().widget(0).updateWalletInfo(

Loading…
Cancel
Save