Skip to content

Commit 86dbd54

Browse files
committed
test: improve mempool_updatefrom efficiency by using getmempoolentry for specific txns
1 parent 803ef70 commit 86dbd54

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

test/functional/mempool_updatefromblock.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def transaction_graph_test(self, size, n_tx_to_mine=None, start_input_txid='', e
8686
unsigned_raw_tx = self.nodes[0].createrawtransaction(inputs, outputs)
8787
signed_raw_tx = self.nodes[0].signrawtransactionwithwallet(unsigned_raw_tx)
8888
tx_id.append(self.nodes[0].sendrawtransaction(signed_raw_tx['hex']))
89-
tx_size.append(self.nodes[0].getrawmempool(True)[tx_id[-1]]['vsize'])
89+
tx_size.append(self.nodes[0].getmempoolentry(tx_id[-1])['vsize'])
9090

9191
if tx_count in n_tx_to_mine:
9292
# The created transactions are mined into blocks by batches.
@@ -109,10 +109,11 @@ def transaction_graph_test(self, size, n_tx_to_mine=None, start_input_txid='', e
109109
self.log.info('Checking descendants/ancestors properties of all of the in-mempool transactions...')
110110
for k, tx in enumerate(tx_id):
111111
self.log.debug('Check transaction #{}.'.format(k))
112-
assert_equal(self.nodes[0].getrawmempool(True)[tx]['descendantcount'], size - k)
113-
assert_equal(self.nodes[0].getrawmempool(True)[tx]['descendantsize'], sum(tx_size[k:size]))
114-
assert_equal(self.nodes[0].getrawmempool(True)[tx]['ancestorcount'], k + 1)
115-
assert_equal(self.nodes[0].getrawmempool(True)[tx]['ancestorsize'], sum(tx_size[0:(k + 1)]))
112+
entry = self.nodes[0].getmempoolentry(tx)
113+
assert_equal(entry['descendantcount'], size - k)
114+
assert_equal(entry['descendantsize'], sum(tx_size[k:size]))
115+
assert_equal(entry['ancestorcount'], k + 1)
116+
assert_equal(entry['ancestorsize'], sum(tx_size[0:(k + 1)]))
116117

117118
def run_test(self):
118119
# Use batch size limited by DEFAULT_ANCESTOR_LIMIT = 25 to not fire "too many unconfirmed parents" error.

0 commit comments

Comments
 (0)