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

pull ismaelsadeeq wants to merge 1 commits into bitcoin:master from ismaelsadeeq:09-2026-maxfeerate-boundary-flaky changing 1 files +1 −1
  1. ismaelsadeeq commented at 12:28 PM on September 29, 2026: member

    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

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

  2. test: avoid testing at the exact `-maxfeerate` boundary
    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.
    025768fb37
  3. DrahtBot added the label Tests on Sep 29, 2026
  4. DrahtBot commented at 12:28 PM on September 29, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/36381.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    ACK furszy, maflcko, achow101

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. furszy commented at 1:52 PM on September 29, 2026: member

    utACK 025768fb37cefdffcfc47376055bedb103699565

  6. fanquake added this to the milestone 33.0 on Sep 29, 2026
  7. maflcko commented at 3:21 PM on September 29, 2026: member

    lgtm ACK 025768fb37cefdffcfc47376055bedb103699565

  8. achow101 commented at 6:18 PM on September 29, 2026: member

    ACK 025768fb37cefdffcfc47376055bedb103699565

  9. achow101 merged this on Sep 29, 2026
  10. achow101 closed this on Sep 29, 2026

  11. davidgumberg commented at 6:40 PM on September 29, 2026: contributor
  12. ismaelsadeeq deleted the branch on Sep 30, 2026
  13. polespinasa commented at 10:49 AM on September 30, 2026: member

    post merge ACK 025768fb37cefdffcfc47376055bedb103699565


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-10-08 23:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me