can also be protocolerror
This commit is contained in:
parent
379144bcfe
commit
5018fe90de
2 changed files with 4 additions and 5 deletions
|
@ -176,4 +176,4 @@ class BasicTransactionTests(IntegrationTestCase):
|
||||||
self.assertEqual(21, len((await self.ledger.get_local_status_and_history(address))[1]))
|
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))
|
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
|
# 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))
|
||||||
|
|
|
@ -4,7 +4,7 @@ from operator import itemgetter
|
||||||
from typing import Dict, Optional, Tuple
|
from typing import Dict, Optional, Tuple
|
||||||
from time import perf_counter
|
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 import __version__
|
||||||
from torba.stream import StreamController
|
from torba.stream import StreamController
|
||||||
|
@ -71,10 +71,9 @@ class ClientSession(BaseClientSession):
|
||||||
)
|
)
|
||||||
log.debug("got reply for %s from %s:%i", method, *self.server)
|
log.debug("got reply for %s from %s:%i", method, *self.server)
|
||||||
return reply
|
return reply
|
||||||
except RPCError as e:
|
except (RPCError, ProtocolError) as e:
|
||||||
if str(e).find('.*no such .*transaction.*') and args:
|
if str(e).find('.*no such .*transaction.*'):
|
||||||
# shouldnt the server return none instead?
|
# shouldnt the server return none instead?
|
||||||
log.warning("Requested transaction missing from server: %s", args[0])
|
|
||||||
return None
|
return None
|
||||||
log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s",
|
log.warning("Wallet server (%s:%i) returned an error. Code: %s Message: %s",
|
||||||
*self.server, *e.args)
|
*self.server, *e.args)
|
||||||
|
|
Loading…
Reference in a new issue