Skip to content

Commit fa48be6

Browse files
author
MarcoFalke
committed
test: Refactor fill_mempool to extract send_batch helper
This is needed for the next commit
1 parent 33adc75 commit fa48be6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/functional/test_framework/mempool_util.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,21 @@ def fill_mempool(test_framework, node):
5757
tx_to_be_evicted_id = ephemeral_miniwallet.send_self_transfer(
5858
from_node=node, utxo_to_spend=confirmed_utxos.pop(0), fee_rate=relayfee)["txid"]
5959

60+
def send_batch(fee):
61+
utxos = confirmed_utxos[:tx_batch_size]
62+
create_lots_of_big_transactions(ephemeral_miniwallet, node, fee, tx_batch_size, txouts, utxos)
63+
del confirmed_utxos[:tx_batch_size]
64+
6065
# Increase the tx fee rate to give the subsequent transactions a higher priority in the mempool
6166
# The tx has an approx. vsize of 65k, i.e. multiplying the previous fee rate (in sats/kvB)
6267
# by 130 should result in a fee that corresponds to 2x of that fee rate
6368
base_fee = relayfee * 130
69+
batch_fees = [(i + 1) * base_fee for i in range(num_of_batches)]
6470

6571
test_framework.log.debug("Fill up the mempool with txs with higher fee rate")
6672
with node.assert_debug_log(["rolling minimum fee bumped"]):
67-
for batch_of_txid in range(num_of_batches):
68-
fee = (batch_of_txid + 1) * base_fee
69-
utxos = confirmed_utxos[:tx_batch_size]
70-
create_lots_of_big_transactions(ephemeral_miniwallet, node, fee, tx_batch_size, txouts, utxos)
71-
del confirmed_utxos[:tx_batch_size]
73+
for fee in batch_fees:
74+
send_batch(fee)
7275

7376
test_framework.log.debug("The tx should be evicted by now")
7477
# The number of transactions created should be greater than the ones present in the mempool

0 commit comments

Comments
 (0)