New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump wallet version to 159900 and remove the usehd
option
#11250
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3829,17 +3829,13 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) | |
|
||
if (fFirstRun) | ||
{ | ||
// Create new keyUser and set as default key | ||
if (gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET) && !walletInstance->IsHDEnabled()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After discussion I believe the removal of the !IsHDEnabled check here is fine but I could totally see it breaking something very subtly, so would be good to get more eyeballs on this line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO the |
||
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key | ||
walletInstance->SetMinVersion(FEATURE_NO_DEFAULT_KEY); | ||
|
||
// ensure this wallet.dat can only be opened by clients supporting HD with chain split | ||
walletInstance->SetMinVersion(FEATURE_HD_SPLIT); | ||
|
||
// generate a new master key | ||
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey(); | ||
if (!walletInstance->SetHDMasterKey(masterPubKey)) | ||
throw std::runtime_error(std::string(__func__) + ": Storing master key failed"); | ||
} | ||
// generate a new master key | ||
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey(); | ||
if (!walletInstance->SetHDMasterKey(masterPubKey)) | ||
throw std::runtime_error(std::string(__func__) + ": Storing master key failed"); | ||
|
||
// Top up the keypool | ||
if (!walletInstance->TopUpKeyPool()) { | ||
|
@@ -3852,7 +3848,7 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) | |
else if (gArgs.IsArgSet("-usehd")) { | ||
bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET); | ||
if (walletInstance->IsHDEnabled() && !useHD) { | ||
InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet"), walletFile)); | ||
InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet or create new non-HD wallets."), walletFile)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new warning will only be printed in subsequent loads of the wallet (after the first start) since the code branch is never executed on first start. |
||
return nullptr; | ||
} | ||
if (!walletInstance->IsHDEnabled() && useHD) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,17 +15,11 @@ class WalletHDTest(BitcoinTestFramework): | |
def set_test_params(self): | ||
self.setup_clean_chain = True | ||
self.num_nodes = 2 | ||
self.extra_args = [['-usehd=0'], ['-usehd=1', '-keypool=0']] | ||
self.extra_args = [[], ['-keypool=0']] | ||
|
||
def run_test (self): | ||
tmpdir = self.options.tmpdir | ||
|
||
# Make sure can't switch off usehd after wallet creation | ||
self.stop_node(1) | ||
self.assert_start_raises_init_error(1, ['-usehd=0'], 'already existing HD wallet') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this test removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops. That was removed originally when I had |
||
self.start_node(1) | ||
connect_nodes_bi(self.nodes, 0, 1) | ||
|
||
# Make sure we use hd, keep masterkeyid | ||
masterkeyid = self.nodes[1].getwalletinfo()['hdmasterkeyid'] | ||
assert_equal(len(masterkeyid), 40) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs mention in the release notes and fixup for check-doc.py