Merge bitcoin/bitcoin#36408: test: allow 3 bytes of fee overestimate in assert_fee_amount
What changed, and why it matters
This is a tiny change to a Bitcoin Core test helper that makes fee-checking tests slightly more tolerant. It is not a security fix and does not affect production wallet code or consensus rules. It simply reduces how often an extremely rare random test failure occurs.
No security action needed. Treat as a routine test-maintenance merge.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies assert_fee_amount() in the functional test framework to allow a fee overestimate of up to 3 bytes instead of 2. The wallet already estimates transaction size assuming a 71-byte low-R ECDSA signature, but actual signatures can be shorter when r or s have leading zero bytes. The change only affects the upper-bound fee check in tests; the lower-bound check remains unchanged. No production code, fee estimation logic, or consensus code is modified.
Changed components
test/functional/test_framework/util.pyInspect captured patch +3 / −2
### test/functional/test_framework/util.py
@@ -64,8 +64,9 @@ def assert_fee_amount(fee, tx_size, feerate_BTC_kvB):
target_fee = get_fee(tx_size, feerate_BTC_kvB)
if fee < target_fee:
raise AssertionError("Fee of %s BTC too low! (Should be %s BTC)" % (str(fee), str(target_fee)))
- # allow the wallet's estimation to be at most 2 bytes off
- high_fee = get_fee(tx_size + 2, feerate_BTC_kvB)
+ # Allow the wallet's estimate to be up to 3 bytes over: a low-R ECDSA
+ # signature can be shorter than the 71 bytes the wallet assumes.
+ high_fee = get_fee(tx_size + 3, feerate_BTC_kvB)
if fee > high_fee:
raise AssertionError("Fee of %s BTC too high! (Should be %s BTC)" % (str(fee), str(target_fee)))
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.