Skip to content

Commit

Permalink
[Wallet] Ensure <0.13 clients can't open HD wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Jul 18, 2016
1 parent 3726910 commit 3b38a6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/release-notes.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -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. 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) [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 Low-level P2P changes
Expand Down
3 changes: 3 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3299,6 +3299,9 @@ bool CWallet::InitLoadWallet()
key.MakeNewKey(true); key.MakeNewKey(true);
if (!walletInstance->SetHDMasterKey(key)) if (!walletInstance->SetHDMasterKey(key))
throw std::runtime_error("CWallet::GenerateNewKey(): Storing master key failed"); 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; CPubKey newDefaultKey;
if (walletInstance->GetKeyFromPool(newDefaultKey)) { if (walletInstance->GetKeyFromPool(newDefaultKey)) {
Expand Down
3 changes: 2 additions & 1 deletion src/wallet/wallet.h
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ enum WalletFeature
FEATURE_WALLETCRYPT = 40000, // wallet encryption FEATURE_WALLETCRYPT = 40000, // wallet encryption
FEATURE_COMPRPUBKEY = 60000, // compressed public keys 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
}; };




Expand Down

0 comments on commit 3b38a6a

Please sign in to comment.