Skip to content

Commit a4f137f

Browse files
committed
[Wallet] Ensure <0.13 clients can't open HD wallets
1 parent 5e3557b commit a4f137f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3299,6 +3299,9 @@ bool CWallet::InitLoadWallet()
32993299
key.MakeNewKey(true);
33003300
if (!walletInstance->SetHDMasterKey(key))
33013301
throw std::runtime_error("CWallet::GenerateNewKey(): Storing master key failed");
3302+
3303+
// ensure this wallet.dat can only be opened by clients supporting HD
3304+
walletInstance->SetMinVersion(FEATURE_HD);
33023305
}
33033306
CPubKey newDefaultKey;
33043307
if (walletInstance->GetKeyFromPool(newDefaultKey)) {

src/wallet/wallet.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ enum WalletFeature
7878
FEATURE_WALLETCRYPT = 40000, // wallet encryption
7979
FEATURE_COMPRPUBKEY = 60000, // compressed public keys
8080

81-
FEATURE_LATEST = 60000
81+
FEATURE_HD = 130000, // Hierarchical key derivation after BIP32 (HD Wallet)
82+
FEATURE_LATEST = FEATURE_COMPRPUBKEY // HD is optional, use FEATURE_COMPRPUBKEY as latest version
8283
};
8384

8485

0 commit comments

Comments
 (0)