Skip to content

Commit

Permalink
Detect -usehd mismatches when wallet.dat already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasschnelli committed Jun 14, 2016
1 parent 17c0131 commit afcd77e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/wallet/wallet.cpp
Expand Up @@ -3236,6 +3236,13 @@ bool CWallet::InitLoadWallet()

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);

Expand Down

0 comments on commit afcd77e

Please sign in to comment.