AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 15 Bitcoin

Merge bitcoin/bitcoin#36381: test: avoid testing at the exact `-maxfeerate` boundary

Public commit record

What the developer wrote

Authored by Ava Chow

100/100 · Strong
Merge 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
✓ 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
The short version

What changed, and why it matters

This 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.

Recommended action

No security action required. Treat as a normal test reliability improvement.

Security signals we found

01

No production code changed

02

Test-only change

03

No memory safety, cryptography, consensus, or authorization changes

04

No input validation or parsing changes in runtime code

Risk score

Why this scored 15/100

Our methodology →
Potential impact 0/30
Exploitability 0/25
Stealth signal 0/15
Affected reach 0/15
Confidence 10/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.