mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
miner: fix empty mempool case for waitNext()
Block template fees are calculated by looping over new_tmpl->vTxFees and return (early) once the fee_threshold is exceeded. This left an edge case when the mempool is empty, which this commit fixes and adds a test for. It does so by using std::accumulate instead of manual loops. Also update interface_ipc.py to account for the new behavior. Co-authored-by: Raimo33 <claudio.raimondi@protonmail.com>
This commit is contained in:
@@ -153,6 +153,7 @@ class IPCInterfaceTest(BitcoinTestFramework):
|
||||
self.log.debug("Wait for a new template")
|
||||
waitoptions = self.capnp_modules['mining'].BlockWaitOptions()
|
||||
waitoptions.timeout = timeout
|
||||
waitoptions.feeThreshold = 1
|
||||
waitnext = template.result.waitNext(ctx, waitoptions)
|
||||
self.generate(self.nodes[0], 1)
|
||||
template2 = await waitnext
|
||||
@@ -168,6 +169,7 @@ class IPCInterfaceTest(BitcoinTestFramework):
|
||||
block3 = await self.parse_and_deserialize_block(template4, ctx)
|
||||
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 template4.result.waitNext(ctx, waitoptions)
|
||||
block4 = await self.parse_and_deserialize_block(template5, ctx)
|
||||
assert_equal(len(block4.vtx), 2)
|
||||
|
||||
Reference in New Issue
Block a user