Deserialize mempool txs in a thread
This commit is contained in:
parent
9bd9476a54
commit
4b3ceff0d2
@ -175,6 +175,7 @@ class MemPool(object):
|
|||||||
'''Process the dictionary of raw transactions and return a dictionary
|
'''Process the dictionary of raw transactions and return a dictionary
|
||||||
of updates to apply to self.txs.
|
of updates to apply to self.txs.
|
||||||
'''
|
'''
|
||||||
|
def deserialize_txs():
|
||||||
script_hashX = self.coin.hashX_from_script
|
script_hashX = self.coin.hashX_from_script
|
||||||
deserializer = self.coin.DESERIALIZER
|
deserializer = self.coin.DESERIALIZER
|
||||||
|
|
||||||
@ -192,6 +193,10 @@ class MemPool(object):
|
|||||||
|
|
||||||
pending.append((tx_hash, txin_pairs, txout_pairs, tx_size))
|
pending.append((tx_hash, txin_pairs, txout_pairs, tx_size))
|
||||||
|
|
||||||
|
# Do this potentially slow operation in a thread so as not to
|
||||||
|
# block
|
||||||
|
await self.tasks.run_in_thread(deserialize_txs)
|
||||||
|
|
||||||
# The transaction inputs can be from other mempool
|
# The transaction inputs can be from other mempool
|
||||||
# transactions (which may or may not be processed yet) or are
|
# transactions (which may or may not be processed yet) or are
|
||||||
# otherwise presumably in the DB.
|
# otherwise presumably in the DB.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user