Commit message · Ava ChowMerge bitcoin/bitcoin#36381: test: avoid testing at the exact `-maxfeerate` boundary
025768fb37cefdffcfc47376055bedb103699565 test: avoid testing at the exact `-maxfeerate` boundary (ismaelsadeeq)
Pull request description:
Fixes #36363
`test_maxfeerate` configured `-maxfeerate=0.00001009` and then created a
transaction requesting the exact same fee rate. This is fragile because the
wallet sizes the fee from the estimated (maximum) signed vsize, while the
`-maxfeerate` limit is checked against the actual signed vsize.
When the actual signature is smaller than the estimate, the actual vsize is smaller than
estimated resulting in a higher feerate and the transaction is rejected, causing
intermittent CI failures.
Request a fee rate slightly below `-maxfeerate` so the transaction is accepted
regardless of the signature size, while still exercising the limit.
Can be reproduced with
```diff
--- a/test/functional/wallet_send.py
+++ b/test/functional/wallet_send.py
@@ -221,8 +221,17 @@ class WalletSendTest(BitcoinTestFramework):
self.nodes[0].sendtoaddress, address=self.nodes[0].getnewaddress(), amount=1, fee_rate=11)
self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), amount=1, fee_rate=9)
- self.restart_node(0, extra_args=['-maxfeerate=0.00001009'])
- self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), amount=1, fee_rate=Decimal("1.009"))
+ self.restart_node(0, extra_args=['-maxfeerate=0.00001009', '-changetype=bech32m'])
+ w = self.nodes[0].get_wallet_rpc(self.default_wallet_name)
+ tr_addr = w.getnewaddress(address_type="bech32m")
+ funding_txid = w.sendtoaddress(tr_addr, 5)
+ self.generate(self.nodes[0], 1)
+ vout = next(o["n"] for o in w.gettransaction(funding_txid, verbose=True)["decoded"]["vout"]
+ if o["scriptPubKey"]["address"] == tr_addr)
+ # Spend the taproot input at exactly maxfeerate. The tr() descriptor
+ # estimates a 65-byte sig but the key-path spend is 64 bytes, so the
+ # estimated vsize always exceeds the actual deterministic rejection.
+ w.send(outputs={w.getnewaddress(): 1}, fee_rate=Decimal("1.009"),
+ options={"inputs": [{"txid": funding_txid, "vout": vout}], "add_inputs": False})
```
The actual failure in #36363 is intermittent because legacy output signatures only sometimes result in a tx size smaller than estimated. It can be reproduced in master by running the test on the file from 100 to 200 times.
And running it again at the same time with this PR does not fail.
ACKs for top commit:
maflcko:
lgtm ACK 025768fb37cefdffcfc47376055bedb103699565
achow101:
ACK 025768fb37cefdffcfc47376055bedb103699565
furszy:
utACK 025768fb37cefdffcfc47376055bedb103699565
Tree-SHA512: 9e70b238f22e6d75108c1b10096008aad5f1bea7ddbb51a11fe722674adcd2dada3dabe577a6049b242fcf826ccd582c16a025b406742ad6b3195a0dae27b44f
100/100 · StrongMessage clarity
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
Why it was queuedsigning boundarysigning or wallet pathmerge-commit duplicate discount
AI analysis · Informational 15/100This commit fixes a flaky automated test in Bitcoin Core. The test was checking the maximum transaction fee rate by creating a transaction at the exact boundary, which sometimes failed because the real transaction size could be slightly smaller than estimated. The fix simply lowers the requested fee rate in the test so it no longer sits exactly on the boundary. There is no change to production code or to any real security behavior.