diff --git a/jmbase/jmbase/twisted_utils.py b/jmbase/jmbase/twisted_utils.py index 6d35029..a5df2e2 100644 --- a/jmbase/jmbase/twisted_utils.py +++ b/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 diff --git a/jmclient/jmclient/wallet_service.py b/jmclient/jmclient/wallet_service.py index 66014ae..98b2da8 100644 --- a/jmclient/jmclient/wallet_service.py +++ b/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, " + diff --git a/scripts/joinmarket-qt.py b/scripts/joinmarket-qt.py index edb6e69..b7dee58 100755 --- a/scripts/joinmarket-qt.py +++ b/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(