mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin/bitcoin#23093: Add ability to flush keypool and always flush when upgrading non-HD to HD
6531599f42test: Add check that newkeypool flushes change addresses too (Samuel Dobson)84fa19c77aAdd release notes for keypool flush changes (Samuel Dobson)f9603ee4e0Add test for flushing keypool with newkeypool (Samuel Dobson)6f6f7bb36cMake legacy wallet upgrades from non-HD to HD always flush the keypool (Samuel Dobson)2434b10781Fix outdated keypool size default (Samuel Dobson)22cc797ca5Add newkeypool RPC to flush the keypool (Samuel Dobson) Pull request description: This PR makes two main changes: 1) Adds a new RPC `newkeypool` which will entirely flush and refill the keypool. 2) When upgradewallet is called on old, non-HD wallets upgrading them to HD, we now always flush the keypool and generate a new one, to immediately start using the HD generated keys. This PR is motivated by a number of users with old, pre-compressed-key wallets upgrading them and being confused about why they still can't generate p2sh-segwit or bech32 addresses -- this is due to uncompressed keys remaining in the keypool post-upgrade and being illegal in these newer address formats. There is currently no easy way to flush the keypool other than to call `getnewaddress` a hundred/thousand times or an ugly hack of using a `sethdseed` call. ACKs for top commit: laanwj: re-ACK6531599f42meshcollider: Added new commit6531599f42to avoid invalidating previous ACKs. instagibbs: ACK6531599f42Tree-SHA512: 50c79c5d42dd27ab0ecdbfdc4071fdaa1b2dbb2f9195ed325b007106ff19226419ce57fe5b1539c0c24101b12f5e034bbcfb7bbb0451b766cb1071295383d774
This commit is contained in:
@@ -489,7 +489,7 @@ bool LegacyScriptPubKeyMan::Upgrade(int prev_version, int new_version, bilingual
|
||||
}
|
||||
// Regenerate the keypool if upgraded to HD
|
||||
if (hd_upgrade) {
|
||||
if (!TopUp()) {
|
||||
if (!NewKeyPool()) {
|
||||
error = _("Unable to generate keys");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user