Detect -usehd mismatches when wallet.dat already exists

This commit is contained in:
Jonas Schnelli 2016-06-13 16:27:41 +02:00
parent 17c0131fad
commit afcd77e179
No known key found for this signature in database
GPG Key ID: 29D4BCB6416F53EC

View File

@ -3236,6 +3236,13 @@ bool CWallet::InitLoadWallet()
walletInstance->SetBestChain(chainActive.GetLocator()); walletInstance->SetBestChain(chainActive.GetLocator());
} }
else if (mapArgs.count("-usehd")) {
bool useHD = GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET);
if (!walletInstance->hdChain.masterKeyID.IsNull() && !useHD)
return InitError(strprintf(_("Error loading %s: You can't disable HD on a already existing HD wallet"), walletFile));
if (walletInstance->hdChain.masterKeyID.IsNull() && useHD)
return InitError(strprintf(_("Error loading %s: You can't enable HD on a already existing non-HD wallet"), walletFile));
}
LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart); LogPrintf(" wallet %15dms\n", GetTimeMillis() - nStart);