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

[Wallet] Ensure <0.13 clients can't open HD wallets #8367

Merged
merged 1 commit into from Jul 19, 2016
Jump to file or symbol
Failed to load files and symbols.
+5 −1
Diff settings

Always

Just for now

[Wallet] Ensure <0.13 clients can't open HD wallets

  • Loading branch information...
jonasschnelli committed Jul 15, 2016
commit a4f137f367a898dc3acddc778c4fe9c53ac303c9
Copy path View file
@@ -3299,6 +3299,9 @@ bool CWallet::InitLoadWallet()
key.MakeNewKey(true);
if (!walletInstance->SetHDMasterKey(key))
throw std::runtime_error("CWallet::GenerateNewKey(): Storing master key failed");

This comment has been minimized.

@MarcoFalke

MarcoFalke Jul 19, 2016

Member

This is dead code. You might as well remove it.

This comment has been minimized.

@MarcoFalke

MarcoFalke Jul 19, 2016

Member

Also the strings in the exceptions have the wrong function names. (Here as well as SetHDMasterKey())

Might as well rework exceptions/return values for those?

// ensure this wallet.dat can only be opened by clients supporting HD
walletInstance->SetMinVersion(FEATURE_HD);

This comment has been minimized.

@TheBlueMatt

TheBlueMatt Jul 19, 2016

Contributor

I think this call should go above SetHDMasterKey...cant have it crash in between and leave the wallet with an HD seed but no minversion set (not that it really matters, but, you know....)

}
CPubKey newDefaultKey;
if (walletInstance->GetKeyFromPool(newDefaultKey)) {
Copy path View file
@@ -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
};
ProTip! Use n and p to navigate between commits in a pull request.