Merge pull request #3095 from lbryio/fix-transaction-getbatch-order
ensure transactions are returned in the order they're requested
This commit is contained in:
commit
23bb5598d5
1 changed files with 3 additions and 3 deletions
|
@ -518,15 +518,15 @@ class LevelDB:
|
||||||
txs = await asyncio.get_event_loop().run_in_executor(
|
txs = await asyncio.get_event_loop().run_in_executor(
|
||||||
self.executor, self._fs_transactions, txids
|
self.executor, self._fs_transactions, txids
|
||||||
)
|
)
|
||||||
|
unsorted_result = {}
|
||||||
|
|
||||||
async def add_result(item):
|
async def add_result(item):
|
||||||
_txid, _tx, _tx_num, _tx_height = item
|
_txid, _tx, _tx_num, _tx_height = item
|
||||||
result[_txid] = (_tx, await self.tx_merkle(_tx_num, _tx_height))
|
unsorted_result[_txid] = (_tx, await self.tx_merkle(_tx_num, _tx_height))
|
||||||
|
|
||||||
result = {}
|
|
||||||
if txs:
|
if txs:
|
||||||
await asyncio.gather(*map(add_result, txs))
|
await asyncio.gather(*map(add_result, txs))
|
||||||
return result
|
return {txid: unsorted_result[txid] for txid, _, _, _ in txs}
|
||||||
|
|
||||||
async def fs_block_hashes(self, height, count):
|
async def fs_block_hashes(self, height, count):
|
||||||
if height + count > len(self.headers):
|
if height + count > len(self.headers):
|
||||||
|
|
Loading…
Reference in a new issue