From af1d7813e9e20e9276547e314d7f29694e863bda Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 24 Nov 2020 11:34:37 -0500 Subject: [PATCH] ensure transactions are returned in the order they're requested --- lbry/wallet/server/leveldb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lbry/wallet/server/leveldb.py b/lbry/wallet/server/leveldb.py index 518a61e40..b87011478 100644 --- a/lbry/wallet/server/leveldb.py +++ b/lbry/wallet/server/leveldb.py @@ -518,15 +518,15 @@ class LevelDB: txs = await asyncio.get_event_loop().run_in_executor( self.executor, self._fs_transactions, txids ) + unsorted_result = {} async def add_result(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: 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): if height + count > len(self.headers):