aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2016-07-15 11:42:47 +0200
committerJonas Schnelli <dev@jonasschnelli.ch>2016-07-18 22:52:49 +0200
commit3b38a6a96a955d7b0192ece6ddcc7d750e155d81 (patch)
tree5ec422834841cce77418cd7b5c4c6ada1deb1956
parent37269105c8817a2922410ec17d976263cd589987 (diff)
downloadbitcoin-3b38a6a96a955d7b0192ece6ddcc7d750e155d81.tar.xz
[Wallet] Ensure <0.13 clients can't open HD wallets
-rw-r--r--doc/release-notes.md2
-rw-r--r--src/wallet/wallet.cpp3
-rw-r--r--src/wallet/wallet.h3
3 files changed, 7 insertions, 1 deletions
diff --git a/doc/release-notes.md b/doc/release-notes.md
index 1b69daf373..b0efd9b630 100644
--- a/doc/release-notes.md
+++ b/doc/release-notes.md
@@ -131,6 +131,8 @@ You can't disable HD key generation once you have created a HD wallet.
There is no distinction between internal (change) and external keys.
+HD wallets are incompatible with older versions of Bitcoin Core.
+
[Pull request](https://github.com/bitcoin/bitcoin/pull/8035/files), [BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)
Low-level P2P changes
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 46ed542158..ae0a546ea1 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -3299,6 +3299,9 @@ bool CWallet::InitLoadWallet()
key.MakeNewKey(true);
if (!walletInstance->SetHDMasterKey(key))
throw std::runtime_error("CWallet::GenerateNewKey(): Storing master key failed");
+
+ // ensure this wallet.dat can only be opened by clients supporting HD
+ walletInstance->SetMinVersion(FEATURE_HD);
}
CPubKey newDefaultKey;
if (walletInstance->GetKeyFromPool(newDefaultKey)) {
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index e9d669a7d1..3a3cb6d851 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -78,7 +78,8 @@ enum WalletFeature
FEATURE_WALLETCRYPT = 40000, // wallet encryption
FEATURE_COMPRPUBKEY = 60000, // compressed public keys
- FEATURE_LATEST = 60000
+ FEATURE_HD = 130000, // Hierarchical key derivation after BIP32 (HD Wallet)
+ FEATURE_LATEST = FEATURE_COMPRPUBKEY // HD is optional, use FEATURE_COMPRPUBKEY as latest version
};