Skip to content

Commit faf8015

Browse files
author
MarcoFalke
committed
test: Add missing sync_mempools() to fill_mempool()
Also disable the function, when it is not needed.
1 parent fa48be6 commit faf8015

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

test/functional/mempool_package_rbf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def test_0fee_package_rbf(self):
554554
self.generate(node, 1)
555555

556556
def test_child_conflicts_parent_mempool_ancestor(self):
557-
fill_mempool(self, self.nodes[0])
557+
fill_mempool(self, self.nodes[0], tx_sync_fun=self.no_op)
558558
# Reset coins since we filled the mempool with current coins
559559
self.coins = self.wallet.get_utxos(mark_as_spent=False, confirmed_only=True)
560560

test/functional/p2p_1p1c_network.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ def set_test_params(self):
4949
def raise_network_minfee(self):
5050
fill_mempool(self, self.nodes[0])
5151

52-
self.log.debug("Wait for the network to sync mempools")
53-
self.sync_mempools()
54-
5552
self.log.debug("Check that all nodes' mempool minimum feerates are above min relay feerate")
5653
for node in self.nodes:
5754
assert_equal(node.getmempoolinfo()['minrelaytxfee'], FEERATE_1SAT_VB)

test/functional/p2p_tx_download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def test_spurious_notfound(self):
250250
def test_rejects_filter_reset(self):
251251
self.log.info('Check that rejected tx is not requested again')
252252
node = self.nodes[0]
253-
fill_mempool(self, node)
253+
fill_mempool(self, node, tx_sync_fun=self.no_op)
254254
self.wallet.rescan_utxos()
255255
mempoolminfee = node.getmempoolinfo()['mempoolminfee']
256256
peer = node.add_p2p_connection(TestP2PConn())

test/functional/test_framework/mempool_util.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
)
2020

2121

22-
def fill_mempool(test_framework, node):
22+
def fill_mempool(test_framework, node, *, tx_sync_fun=None):
2323
"""Fill mempool until eviction.
2424
2525
Allows for simpler testing of scenarios with floating mempoolminfee > minrelay
26-
Requires -datacarriersize=100000 and
27-
-maxmempool=5.
28-
It will not ensure mempools become synced as it
29-
is based on a single node and assumes -minrelaytxfee
26+
Requires -datacarriersize=100000 and -maxmempool=5 and assumes -minrelaytxfee
3027
is 1 sat/vbyte.
3128
To avoid unintentional tx dependencies, the mempool filling txs are created with a
3229
tagged ephemeral miniwallet instance.
@@ -69,9 +66,13 @@ def send_batch(fee):
6966
batch_fees = [(i + 1) * base_fee for i in range(num_of_batches)]
7067

7168
test_framework.log.debug("Fill up the mempool with txs with higher fee rate")
72-
with node.assert_debug_log(["rolling minimum fee bumped"]):
73-
for fee in batch_fees:
74-
send_batch(fee)
69+
for fee in batch_fees[:-3]:
70+
send_batch(fee)
71+
tx_sync_fun() if tx_sync_fun else test_framework.sync_mempools() # sync before any eviction
72+
assert_equal(node.getmempoolinfo()["mempoolminfee"], Decimal("0.00001000"))
73+
for fee in batch_fees[-3:]:
74+
send_batch(fee)
75+
tx_sync_fun() if tx_sync_fun else test_framework.sync_mempools() # sync after all evictions
7576

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

0 commit comments

Comments
 (0)