aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mempool_updatefromblock.py
diff options
context:
space:
mode:
authorMichael Dietz <michael.dietz@waya.ai>2021-08-16 17:56:28 +0500
committerMichael Dietz <michael.dietz@waya.ai>2021-08-16 17:56:28 +0500
commit86dbd54ae8a8f9c693c0ea67114bbff24a0754df (patch)
tree4f9360913e5d36dc881845621222a52ce7e43f4a /test/functional/mempool_updatefromblock.py
parent803ef70fd9f65ef800567ff9456fac525bc3e3c2 (diff)
downloadbitcoin-86dbd54ae8a8f9c693c0ea67114bbff24a0754df.tar.xz
test: improve mempool_updatefrom efficiency by using getmempoolentry for specific txns
Diffstat (limited to 'test/functional/mempool_updatefromblock.py')
-rwxr-xr-xtest/functional/mempool_updatefromblock.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/mempool_updatefromblock.py b/test/functional/mempool_updatefromblock.py
index 8baf974a0a..4cd11e9d11 100755
--- a/test/functional/mempool_updatefromblock.py
+++ b/test/functional/mempool_updatefromblock.py
@@ -86,7 +86,7 @@ class MempoolUpdateFromBlockTest(BitcoinTestFramework):
unsigned_raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
signed_raw_tx = self.nodes[0].signrawtransactionwithwallet(unsigned_raw_tx)
tx_id.append(self.nodes[0].sendrawtransaction(signed_raw_tx['hex']))
- tx_size.append(self.nodes[0].getrawmempool(True)[tx_id[-1]]['vsize'])
+ tx_size.append(self.nodes[0].getmempoolentry(tx_id[-1])['vsize'])
if tx_count in n_tx_to_mine:
# The created transactions are mined into blocks by batches.
@@ -109,10 +109,11 @@ class MempoolUpdateFromBlockTest(BitcoinTestFramework):
self.log.info('Checking descendants/ancestors properties of all of the in-mempool transactions...')
for k, tx in enumerate(tx_id):
self.log.debug('Check transaction #{}.'.format(k))
- assert_equal(self.nodes[0].getrawmempool(True)[tx]['descendantcount'], size - k)
- assert_equal(self.nodes[0].getrawmempool(True)[tx]['descendantsize'], sum(tx_size[k:size]))
- assert_equal(self.nodes[0].getrawmempool(True)[tx]['ancestorcount'], k + 1)
- assert_equal(self.nodes[0].getrawmempool(True)[tx]['ancestorsize'], sum(tx_size[0:(k + 1)]))
+ entry = self.nodes[0].getmempoolentry(tx)
+ assert_equal(entry['descendantcount'], size - k)
+ assert_equal(entry['descendantsize'], sum(tx_size[k:size]))
+ assert_equal(entry['ancestorcount'], k + 1)
+ assert_equal(entry['ancestorsize'], sum(tx_size[0:(k + 1)]))
def run_test(self):
# Use batch size limited by DEFAULT_ANCESTOR_LIMIT = 25 to not fire "too many unconfirmed parents" error.