From 4a6af0b938a5b5677f4079397e9db453ab312568 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 16 Sep 2019 05:26:32 -0300 Subject: [PATCH] retriable resolve --- lbry/lbry/wallet/ledger.py | 4 +++- lbry/tests/integration/test_resolve_command.py | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lbry/lbry/wallet/ledger.py b/lbry/lbry/wallet/ledger.py index 589e1634b..cab0574d0 100644 --- a/lbry/lbry/wallet/ledger.py +++ b/lbry/lbry/wallet/ledger.py @@ -1,6 +1,7 @@ import asyncio import logging from binascii import unhexlify +from functools import partial from typing import Tuple, List from datetime import datetime @@ -60,7 +61,8 @@ class MainNetLedger(BaseLedger): return outputs.inflate(txs), outputs.offset, outputs.total async def resolve(self, urls): - txos = (await self._inflate_outputs(self.network.resolve(urls)))[0] + resolve = partial(self.network.retriable_call, self.network.resolve) + txos = (await self._inflate_outputs(resolve(urls)))[0] assert len(urls) == len(txos), "Mismatch between urls requested for resolve and responses received." result = {} for url, txo in zip(urls, txos): diff --git a/lbry/tests/integration/test_resolve_command.py b/lbry/tests/integration/test_resolve_command.py index b7f4bf67d..f511e6944 100644 --- a/lbry/tests/integration/test_resolve_command.py +++ b/lbry/tests/integration/test_resolve_command.py @@ -86,6 +86,12 @@ class ResolveCommand(BaseResolveTestCase): self.assertEqual(claim['name'], 'gibberish') self.assertNotIn('value', claim) + # resolve retries + await self.conductor.spv_node.stop() + resolving_future = asyncio.ensure_future(self.resolve('foo')) + await self.conductor.spv_node.start(self.conductor.blockchain_node) + self.assertIsNotNone((await resolving_future)['foo']['claim_id']) + async def test_winning_by_effective_amount(self): # first one remains winner unless something else changes claim_id1 = self.get_claim_id(