From 5018fe90debff7b42db62f854aa7e6dfa67443ca Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Sun, 1 Sep 2019 00:02:07 -0300 Subject: [PATCH] can also be protocolerror --- torba/tests/client_tests/integration/test_transactions.py | 2 +- torba/torba/client/basenetwork.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/torba/tests/client_tests/integration/test_transactions.py b/torba/tests/client_tests/integration/test_transactions.py index f7f7581a0..0e1b4b898 100644 --- a/torba/tests/client_tests/integration/test_transactions.py +++ b/torba/tests/client_tests/integration/test_transactions.py @@ -176,4 +176,4 @@ class BasicTransactionTests(IntegrationTestCase): self.assertEqual(21, len((await self.ledger.get_local_status_and_history(address))[1])) self.assertEqual(0, len(self.ledger._known_addresses_out_of_sync)) # should be another test, but it would be too much to setup just for that and it affects sync - self.assertIsNone(await self.ledger.network.get_transaction('1'*64)) + self.assertIsNone(await self.ledger.network.retriable_call(self.ledger.network.get_transaction, '1'*64)) diff --git a/torba/torba/client/basenetwork.py b/torba/torba/client/basenetwork.py index 6bb789d3d..c79a9274e 100644 --- a/torba/torba/client/basenetwork.py +++ b/torba/torba/client/basenetwork.py @@ -4,7 +4,7 @@ from operator import itemgetter from typing import Dict, Optional, Tuple from time import perf_counter -from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError +from torba.rpc import RPCSession as BaseClientSession, Connector, RPCError, ProtocolError from torba import __version__ from torba.stream import StreamController @@ -71,10 +71,9 @@ class ClientSession(BaseClientSession): ) log.debug("got reply for %s from %s:%i", method, *self.server) return reply - except RPCError as e: - if str(e).find('.*no such .*transaction.*') and args: + except (RPCError, ProtocolError) as e: + if str(e).find('.*no such .*transaction.*'): # shouldnt the server return none instead? - log.warning("Requested transaction missing from server: %s", args[0]) return None log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s", *self.server, *e.args)