wallet: avoid global access in external signer SPKM #35429

pull w0xlt wants to merge 2 commits into bitcoin:master from w0xlt:wallet-external-signer-no-globals changing 5 files +55 −27
  1. w0xlt commented at 3:39 AM on June 1, 2026: contributor

    This PR removes direct access to process-wide state from ExternalSignerScriptPubKeyMan.

    Instead of reading gArgs/Params() from the SPKM, the wallet load/setup path now reads the external signer command and chain once, stores them on CWallet, and passes the narrow values into the external signer SPKM.

    This keeps argument and chain selection at the wallet boundary and makes the SPKM less coupled to global state.

  2. wallet: avoid global access in external signer SPKM
    ExternalSignerScriptPubKeyMan::GetExternalSigner() reached into global state
    (gArgs for -signer, Params() for the chain type) from deep inside the signing
    and descriptor-setup paths.
    
    Capture both in LoadWalletArgs -- where the wallet already reads its other
    settings from the injected WalletContext -- store them on CWallet, and inject
    them into ExternalSignerScriptPubKeyMan at construction. GetExternalSigner()
    now takes the command and chain as parameters.
    
    No behavior change: when -signer is unset the command is empty and the same
    "restart bitcoind with -signer" error is returned; the chain string is the
    value Params().GetChainTypeString() previously provided.
    3fbb2d0a60
  3. test: cover GetExternalSigner command handling
    Add a unit test asserting that GetExternalSigner() with an empty command
    returns the "needs -signer" error, before any external process is launched.
    c0dc4d5091
  4. DrahtBot added the label Wallet on Jun 1, 2026
  5. DrahtBot commented at 3:39 AM on June 1, 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/35429.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

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

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

Contributors
Labels

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-06-01 05:51 UTC

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