test: Replace hardcoded extended keys with ExtendedKey helpers #36710

pull nebula-21 wants to merge 1 commits into bitcoin:master from nebula-21:replace-hardcoded-keys changing 10 files +42 −39
  1. nebula-21 commented at 3:35 PM on October 30, 2026: contributor

    This PR is a follow-up of [PR #35543](https://github.com/bitcoin/bitcoin/pull/35543). I've updated the tests that were still using hardcoded keys, and used the ExtendedKey classes instead.

  2. DrahtBot added the label Tests on Oct 30, 2026
  3. DrahtBot commented at 3:35 PM on October 30, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #36577 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36577.svg"></sub> (psbt: check sig sighash only if a type is given by fametrano)
    • #36005 <sub><img src="https://drahtbot.space/ack_count/bitcoin/bitcoin/36005.svg"></sub> (rpc, descriptor: warn when multipath expansion clones single-path key expressions by pythcoiner)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where comparison-specific test macros should replace generic comparisons:

    • test/functional/wallet_backwards_compatibility.py: assert miniscript_apos != miniscript_desc → Prefer assert_not_equal(miniscript_apos, miniscript_desc).

    <sup>2026-11-03 12:23:46</sup>

  4. DrahtBot added the label Needs rebase on Oct 31, 2026
  5. test: Replace hardcoded extended keys with ExtendedKey helpers f805f095fd
  6. nebula-21 force-pushed on Nov 3, 2026
  7. nebula-21 marked this as a draft on Nov 3, 2026
  8. nebula-21 marked this as ready for review on Nov 3, 2026
  9. DrahtBot removed the label Needs rebase on Nov 3, 2026
  10. in test/functional/wallet_miniscript.py:15 in f805f095fd
      24 | -    "tpubD6NzVbkrYhZ4WsqRzDmkL82SWcu42JzUvKWzrJHQ8EC2vEHRHkXj1De93sD3biLrKd8XGnamXURGjMbYavbszVDXpjXV2cGUERucLJkE6cy",
      25 | -    "tpubDEFLeBkKTm8aiYkySz8hXAXPVnPSfxMi7Fxhg9sejUrkwJuRWvPdLEiXjTDbhGbjLKCZUDUUibLxTnK5UP1q7qYrSnPqnNe7M8mvAW1STcc",
      26 | -    "tpubD6NzVbkrYhZ4WR99ygpiJvPMAJiwahjLgGywc5vJx2gUfKUfEPCrbKmQczDPJZmLcyZzRb5Ti6rfUb89S2WFyPH7FDtD6RFDA1hdgTEgEUL",
      27 | -]
      28 | +TPRVS = [ExtendedPrivateKey.generate().to_string() for _ in range(0, 3)]
      29 | +TPUBS = [ExtendedPrivateKey.generate().pubkey().to_string() for _ in range(0, 7)]
    


    polespinasa commented at 6:15 PM on November 4, 2026:

    in f805f095fd8c8e2b4b7a46490069b5dfa8751586 test: Replace hardcoded extended keys with ExtendedKey helpers

    If I am not wrong this can cause some problems when running the test framework with --randomseed=. As same seed could produce different results, making errors non reproducible. This is because the seed is not applied into the rng before you call a function.

    A solution to this would be to not use an rng for this test and hardcode some value. For example:

    $ git diff
    diff --git a/test/functional/wallet_miniscript.py b/test/functional/wallet_miniscript.py
    index 6daf21b9b3..a6d9cb6843 100755
    --- a/test/functional/wallet_miniscript.py
    +++ b/test/functional/wallet_miniscript.py
    @@ -10,9 +10,8 @@ from test_framework.psbt import PSBT, PSBT_IN_SHA256
     from test_framework.test_framework import BitcoinTestFramework
     from test_framework.util import assert_equal
     
    
    -TPRVS = [ExtendedPrivateKey.generate().to_string() for _ in range(0, 3)]
    -TPUBS = [ExtendedPrivateKey.generate().pubkey().to_string() for _ in range(0, 7)]
    +TPRVS = [ExtendedPrivateKey.from_seed(f"miniscript-private-{i}".encode()).to_string() for i in range(3)]
    +TPUBS = [ExtendedPrivateKey.from_seed(f"miniscript-public-{i}".encode()).pubkey().to_string() for i in range(7)]
     PUBKEYS = [
         "02aebf2d10b040eb936a6f02f44ee82f8b34f5c1ccb20ff3949c2b28206b7c1068",
         "030f64b922aee2fd597f104bc6cb3b670f1ca2c6c49b1071a1a6c010575d94fe5a",
    
    
  11. polespinasa commented at 6:15 PM on November 4, 2026: member

    cACK


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-11-10 21:51 UTC

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