This is a minor clenaup after #9294.
This makes SetHDMasterKey responsible for maintinaing the CHDChain version instead of always creating it with the latest version and making EncryptWallet responsible for keeping the version from changing.
This is a minor clenaup after #9294.
This makes SetHDMasterKey responsible for maintinaing the CHDChain version instead of always creating it with the latest version and making EncryptWallet responsible for keeping the version from changing.
utACK fdd15f770a649be57a1c6abc346cd4d0da831493
638 | @@ -639,9 +639,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
639 | if (IsHDEnabled()) {
640 | CKey key;
nit: remove this unused variable in this commit (it was unused before your PR, but since you're here...)
638 | @@ -639,9 +639,7 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) 639 | if (IsHDEnabled()) { 640 | CKey key; 641 | CPubKey masterPubKey = GenerateNewHDMasterKey(); 642 | - // preserve the old chains version to not break backward compatibility 643 | - CHDChain oldChain = GetHDChain(); 644 | - if (!SetHDMasterKey(masterPubKey, &oldChain)) 645 | + if (!SetHDMasterKey(masterPubKey))
suggestion only: combine this with the line above to:
if (!SetHDMasterKey(GenerateNewHDMasterKey()))
Also: curly braces for single line if block please.
1055 | @@ -1056,9 +1056,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface 1056 | CPubKey GenerateNewHDMasterKey(); 1057 | 1058 | /* Set the current HD master key (will reset the chain child index counters) 1059 | - If possibleOldChain is provided, the parameters from the old chain (version) 1060 | - will be preserved. */ 1061 | - bool SetHDMasterKey(const CPubKey& key, CHDChain *possibleOldChain = nullptr); 1062 | + Sets the master keys version based on the current wallet version (so make 1063 | + its set appropriately before calling this). */
Couple of grammar/typos here. Suggest you replace with: The master key version is set to the current wallet version, so the caller must ensure that current wallet version is correct before calling this function. or similar
couple of nits, but otherwise utACK fdd15f770a649be57a1c6abc346cd4d0da831493
Resolved @jnewbery's minor comments.
This makes SetHDMasterKey responsible for maintinaing the CHDChain
version instead of always creating it with the latest version and
making EncryptWallet responsible for keeping the version from
changing.
1055 | @@ -1056,9 +1056,10 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface 1056 | CPubKey GenerateNewHDMasterKey(); 1057 | 1058 | /* Set the current HD master key (will reset the chain child index counters) 1059 | - If possibleOldChain is provided, the parameters from the old chain (version) 1060 | - will be preserved. */ 1061 | - bool SetHDMasterKey(const CPubKey& key, CHDChain *possibleOldChain = nullptr); 1062 | + Sets the master keys version based on the current wallet version (so the
nit: you missed one of the grammar errors: s/keys/key's/ . There's only one of them.
(sorry - normally I wouldn't nit for grammar, but this could be misleading - hence my earlier suggestion to reword)
Oops, sorry, missed that one
utACK 185c7f08be68eec878f4b32b3a52145dd57e13bd