From 0e483f1241e0c33e32cec79813ed726d11d1e118 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 1 Dec 2020 12:06:39 +0000 Subject: [PATCH] Handle None return from _rpc() in get_transaction() Before this commit, if an RPC connection failure occurred, while the program is shutting down, it could raise an Exception in the BitcoinCoreInterface.get_transaction() call triggered by the WalletService.transaction_monitor loop. This commit prevents that. --- jmclient/jmclient/blockchaininterface.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jmclient/jmclient/blockchaininterface.py b/jmclient/jmclient/blockchaininterface.py index caf67c2..45ee155 100644 --- a/jmclient/jmclient/blockchaininterface.py +++ b/jmclient/jmclient/blockchaininterface.py @@ -341,6 +341,9 @@ class BitcoinCoreInterface(BlockchainInterface): log.warn("Failed gettransaction call; unexpected error:") log.warn(str(e)) return None + if res is None: + # happens in case of rpc connection failure: + return None if "confirmations" not in res: log.warning("Malformed gettx result: " + str(res)) return None