From 138d9e7f568ef29e33ae20e45fcdc959ae320a69 Mon Sep 17 00:00:00 2001 From: lateminer Date: Tue, 2 Jan 2018 13:18:39 +0300 Subject: [PATCH] [Wallet] Ensure <0.13 clients can't open HD wallets https://github.com/lateminer/bitcoin/commit/3b38a6a96a955d7b0192ece6ddcc7d750e155d81 --- src/init.cpp | 2 -- src/wallet/wallet.cpp | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index 63c02ef4a..848047ef9 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1546,8 +1546,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) key.MakeNewKey(true); if (!pwalletMain->SetHDMasterKey(key)) throw std::runtime_error("CWallet::GenerateNewKey(): Storing master key failed"); - // ensure this wallet.dat can only be opened by clients supporting HD - pwalletMain->SetMinVersion(FEATURE_HD); } CPubKey newDefaultKey; if (pwalletMain->GetKeyFromPool(newDefaultKey)) { diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index f9d6ee671..f07b8c753 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1382,6 +1382,9 @@ bool CWallet::SetHDMasterKey(const CKey& key) { LOCK(cs_wallet); + // ensure this wallet.dat can only be opened by clients supporting HD + SetMinVersion(FEATURE_HD); + // store the key as normal "key"/"ckey" object // in the database // key metadata is not required