We add a parallel UTXO precache mechanism to the SynchMempoolTask. This mechanism looks UTXOs up in the utxodb as we are busy downloading mempool txns from bitcoind. The benefit is not large for small mempools but on e.g. BTC with ~140k txns in the mempool, the performance benefit is up to ~33% over existing code. This is because we utilize the disk and CPU concurrently with the network while downloading large mempools.
Also in this PR:
Refactor of the SynchMempoolTask into its own compilation unit and header.
BUGFIX! -- A corner case on BTC could occur where a "failed" txn during mempool synch would be downloaded after its children. If the parent and children were evicted during download, but we managed to grab the children before the eviction, but the parent after (as can happen with RBF for example), inconsistent behavior from the server could be observed.
In such cases the SynchMempoolTask would attempt to add the child txns to the mempool but the parent would be missing, thus inputs would be missing, and this would lead to an exception being thrown and the mempool being left in a state where not all its data structures for the new txns would be filled-in, leading to observed behavior of scripthash notifications for the txns in question not being sent to clients.
We add a parallel UTXO precache mechanism to the
SynchMempoolTask
. This mechanism looks UTXOs up in the utxodb as we are busy downloading mempool txns from bitcoind. The benefit is not large for small mempools but on e.g. BTC with ~140k txns in the mempool, the performance benefit is up to ~33% over existing code. This is because we utilize the disk and CPU concurrently with the network while downloading large mempools.Also in this PR:
SynchMempoolTask
into its own compilation unit and header.SynchMempoolTask
would attempt to add the child txns to the mempool but the parent would be missing, thus inputs would be missing, and this would lead to an exception being thrown and the mempool being left in a state where not all its data structures for the new txns would be filled-in, leading to observed behavior of scripthash notifications for the txns in question not being sent to clients.