In https://github.com/bitcoin/bitcoin/pull/35598/changes/0de7c2bf7912d5632c33195b7764e06c46e5f7b0: test: cover feeThreshold = MAX_MONEY
non_blocking nit
Looking at this again, my understanding is that the transaction added above is intentionally kept in the mempool to verify that feeThreshold = MAX_MONEY ignores a fee increase and still times out. That part makes sense.
After the timeout, however, that transaction remains in the mempool and is not included in template2. Therefore, once feeThreshold is changed to 1, it already satisfies the threshold before this second wait starts. waitNext is allowed to return without waiting for the transaction added by this lambda.
Verified this by delaying the lambda
index 85a7b8bf11..fe5b861614 100755
--- a/test/functional/interface_ipc_mining.py
+++ b/test/functional/interface_ipc_mining.py
@@ -299,7 +299,8 @@ class IPCMiningTest(BitcoinTestFramework):
waitoptions.feeThreshold = 1
template4 = await wait_and_do(
mining_wait_next_template(template2, stack, ctx, waitoptions),
- lambda: self.miniwallet.send_self_transfer(fee_rate=10, from_node=self.nodes[0]))
+ lambda: self.miniwallet.send_self_transfer(fee_rate=10, from_node=self.nodes[0]),
+ sleep_time=1.1 * self.options.timeout_factor)
assert template4 is not None
block3 = await mining_get_block(template4, ctx)
assert_equal(len(block3.vtx), 3)
The test fails when asserting the transaction count because it only contains 2 transactions. Would it be clearer to consume the existing fee increase directly here?
index 85a7b8bf11..57c1b60b98 100755
--- a/test/functional/interface_ipc_mining.py
+++ b/test/functional/interface_ipc_mining.py
@@ -295,21 +295,19 @@ class IPCMiningTest(BitcoinTestFramework):
assert template3 is None
waitoptions.timeout = self.default_ipc_timeout
- self.log.debug("Wait for another, get one after increase in fees in the mempool")
+ self.log.debug("Wait for another, get one for the fees already in the mempool")
waitoptions.feeThreshold = 1
- template4 = await wait_and_do(
- mining_wait_next_template(template2, stack, ctx, waitoptions),
- lambda: self.miniwallet.send_self_transfer(fee_rate=10, from_node=self.nodes[0]))
+ template4 = await mining_wait_next_template(template2, stack, ctx, waitoptions)
assert template4 is not None
block3 = await mining_get_block(template4, ctx)
- assert_equal(len(block3.vtx), 3)
+ assert_equal(len(block3.vtx), 2)
self.log.debug("Wait again, this should return the same template, since the fee threshold is zero")
waitoptions.feeThreshold = 0
template5 = await mining_wait_next_template(template4, stack, ctx, waitoptions)
assert template5 is not None
block4 = await mining_get_block(template5, ctx)
- assert_equal(len(block4.vtx), 3)
+ assert_equal(len(block4.vtx), 2)
waitoptions.feeThreshold = 1
self.log.debug("Wait for another, get one after increase in fees in the mempool")
@@ -318,7 +316,7 @@ class IPCMiningTest(BitcoinTestFramework):
lambda: self.miniwallet.send_self_transfer(fee_rate=10, from_node=self.nodes[0]))
assert template6 is not None
block4 = await mining_get_block(template6, ctx)
- assert_equal(len(block4.vtx), 4)
+ assert_equal(len(block4.vtx), 3)
self.log.debug("Wait for another, but time out, since the fee threshold is set now")
template7 = await mining_wait_next_template(template6, stack, ctx, waitoptions)
Later on template6 would still test adding a transaction while waitNext is active, verifying that a new template is returned