test: Prevent loop from running out of utxos in bip68 test #34244

pull fjahr wants to merge 1 commits into bitcoin:master from fjahr:2026-01-bip68-flaky changing 1 files +2 −2
  1. fjahr commented at 11:08 pm on January 9, 2026: contributor

    This tries to fix #34205

    I stared at the test code quite a bit and initially suspected some MiniWallet internals to be the issue but I think that was the wrong direction and there is simply a very small chance that the loop in test_sequence_lock_confirmed_inputs runs out of available utxos: We are starting out with 200-250 utxos and run the loop 400 times. If a transaction is accepted it could have up to 10 inputs but it always has only one output, so the pool is depleting in this case. And it’s actually even worse because the output produced is not recognized as spendable by the MiniWallet because it is not using the correct output script. However, only a small fraction of transactions are actually accepted, which is why this issue almost never occurs. I did some extra printing and usually we end up with >100 utxos still available by the end of the test. But there is a small chance that too many transactions are accepted and then we can run out of utxos.

    I considered two fixes: The first was a break at the beginning of the loop if available_utxos == 0: break, this would work fine but I went with the second option: Simply creating the output with the correct output script so that MiniWallet recognizes it as spendable. This minimal replentishment of available utxos ensures that at worst we should get a few 1 input, 1 ouput transactions by the end but we should never run out of available utxos. I didn’t look back in history but I suspect that this is how it was intended before MiniWallet introduced.

    Also moves the random import in the same function to the top of the file.

  2. test: Prevent loop from running out of utxos in bip68 test ab41492c6b
  3. DrahtBot added the label Tests on Jan 9, 2026
  4. DrahtBot commented at 11:08 pm on January 9, 2026: contributor

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

    Code Coverage & Benchmarks

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. maflcko commented at 11:29 am on January 10, 2026: member
    lgtm ACK ab41492c6ba7d3d68b53bf4299642a4f848a429f

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-01-12 00:13 UTC

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