keypoolrefill doesn’t fill keypool to specified parameter #29924

issue Christewart openend this issue on April 20, 2024
  1. Christewart commented at 8:32 pm on April 20, 2024: contributor

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    According to the help manual the parameter is newsize and keypoolrefill fills the keypool to newsize. This was the behavior up to at least v21 of bitcoind. In v24 of bitcoind these semantics have changed. Related to https://github.com/bitcoin-s/bitcoin-s/pull/5496

     0$ bitcoin-cli -regtest getwalletinfo
     1{
     2  "walletname": "",
     3  "walletversion": 169900,
     4  "format": "sqlite",
     5  "balance": 50.00000000,
     6  "unconfirmed_balance": 0.00000000,
     7  "immature_balance": 3675.00000000,
     8  "txcount": 101,
     9  "keypoolsize": 4000,
    10  "keypoolsize_hd_internal": 4000,
    11  "paytxfee": 0.00000000,
    12  "private_keys_enabled": true,                                                                                                                                                                             
    13  "avoid_reuse": false,        
    14  "scanning": false,
    15  "descriptors": true,
    16  "external_signer": false
    17}
    

    So I have a keypool of size 4,000

    0$ bitcoin-cli -regtest keypoolrefill 4001
    

    Somehow I end up with a keypool size of 16,004?

     0$ bitcoin-cli -regtest getwalletinfo
     1{
     2  "walletname": "",
     3  "walletversion": 169900,
     4  "format": "sqlite",
     5  "balance": 50.00000000,
     6  "unconfirmed_balance": 0.00000000,
     7  "immature_balance": 3675.00000000,
     8  "txcount": 101,
     9  "keypoolsize": 16004,
    10  "keypoolsize_hd_internal": 16004,
    11  "paytxfee": 0.00000000,
    12  "private_keys_enabled": true,
    13  "avoid_reuse": false,
    14  "scanning": false,
    15  "descriptors": true,
    16  "external_signer": false
    17}
    

    Expected behaviour

    I would expect keypoolrefill to fill up the keypool to the given parameter.

    Steps to reproduce

    Run commands given in the issue

    Relevant log output

    No response

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    Bitcoin Core version v24.2.0

    Operating system and version

    Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:41 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T8103 arm64

    Machine specifications

    No response

  2. Christewart referenced this in commit 014c38d6f8 on Apr 20, 2024
  3. Christewart referenced this in commit 9442dba217 on Apr 20, 2024
  4. laanwj added the label Wallet on Apr 22, 2024
  5. brunoerg commented at 5:18 pm on May 7, 2024: contributor
    I think you have more than one ScriptPubKeyManager. When you call keypoolrefill it will top up every spkm. Did you check listdescriptors?

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: 2024-12-21 15:12 UTC

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