forked from LBRYCommunity/lbry-sdk
retriable resolve
This commit is contained in:
parent
9c5b4e3cc9
commit
4a6af0b938
2 changed files with 9 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from binascii import unhexlify
|
from binascii import unhexlify
|
||||||
|
from functools import partial
|
||||||
from typing import Tuple, List
|
from typing import Tuple, List
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
@ -60,7 +61,8 @@ class MainNetLedger(BaseLedger):
|
||||||
return outputs.inflate(txs), outputs.offset, outputs.total
|
return outputs.inflate(txs), outputs.offset, outputs.total
|
||||||
|
|
||||||
async def resolve(self, urls):
|
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."
|
assert len(urls) == len(txos), "Mismatch between urls requested for resolve and responses received."
|
||||||
result = {}
|
result = {}
|
||||||
for url, txo in zip(urls, txos):
|
for url, txo in zip(urls, txos):
|
||||||
|
|
|
@ -86,6 +86,12 @@ class ResolveCommand(BaseResolveTestCase):
|
||||||
self.assertEqual(claim['name'], 'gibberish')
|
self.assertEqual(claim['name'], 'gibberish')
|
||||||
self.assertNotIn('value', claim)
|
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):
|
async def test_winning_by_effective_amount(self):
|
||||||
# first one remains winner unless something else changes
|
# first one remains winner unless something else changes
|
||||||
claim_id1 = self.get_claim_id(
|
claim_id1 = self.get_claim_id(
|
||||||
|
|
Loading…
Reference in a new issue