- Add
keypool_critical
(configurable). If the number of keys in the keypool drops below this limit while the wallet is rescanning, shutdown the node. Do not shutdown the node if the wallet is ‘current’, ie it is receivingBlockConnected
calls from the node. - Add
keypool_min
(configurable). If the number of keys in the keypool drops below this limit, stop advancing the wallet’s best block. This forces the wallet to rescan from the point that it dropped below the limit the next time that it starts up. This is a toggle controlled bym_update_best_block
, which doesn’t get unset until the wallet has rescanned with the keypool above keypool_min. - Add
bypasskeypoolcritical
(command line argument). This disables the keypool_critical behavior, so the user has a chance to top up their keypool. - don’t allow user actions like
getnewaddress
to cause the keypool to drop below the critical limit (return an error telling the user to unlock and topup their keypool).
This is a simpler version of #10830 , which caused the node to stop sync’ing if the keypool dropped below a certain limit. It is built on top of #11022 which does the following:
- if a key in the keypool is used, mark all keys in the keypool up to that key as used
- try to top up the keypool when keys from the keypool are used.
This PR couldn’t be merged for v0.15 because there are some edge cases that make this dangerous and could result in users not being able to start up the node without onerous recovery steps.