Skip to content

keypoolrefill doesn't fill keypool to specified parameter #29924

@Christewart

Description

@Christewart

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 bitcoin-s/bitcoin-s#5496

$ bitcoin-cli -regtest getwalletinfo
{
  "walletname": "",
  "walletversion": 169900,
  "format": "sqlite",
  "balance": 50.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 3675.00000000,
  "txcount": 101,
  "keypoolsize": 4000,
  "keypoolsize_hd_internal": 4000,
  "paytxfee": 0.00000000,
  "private_keys_enabled": true,                                                                                                                                                                             
  "avoid_reuse": false,        
  "scanning": false,
  "descriptors": true,
  "external_signer": false
}

So I have a keypool of size 4,000

$ bitcoin-cli -regtest keypoolrefill 4001

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

$ bitcoin-cli -regtest getwalletinfo
{
  "walletname": "",
  "walletversion": 169900,
  "format": "sqlite",
  "balance": 50.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 3675.00000000,
  "txcount": 101,
  "keypoolsize": 16004,
  "keypoolsize_hd_internal": 16004,
  "paytxfee": 0.00000000,
  "private_keys_enabled": true,
  "avoid_reuse": false,
  "scanning": false,
  "descriptors": true,
  "external_signer": false
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions