Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/wallet.cpp
Show First 20 Lines • Show All 4,517 Lines • ▼ Show 20 Lines | if (gArgs.GetBoolArg("-upgradewallet", false)) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if (fFirstRun) { | if (fFirstRun) { | ||||
// Ensure this wallet.dat can only be opened by clients supporting | // Ensure this wallet.dat can only be opened by clients supporting | ||||
// HD with chain split and expects no default key. | // HD with chain split and expects no default key. | ||||
if (!gArgs.GetBoolArg("-usehd", true)) { | |||||
InitError(strprintf(_("Error creating %s: You can't create non-HD " | |||||
"wallets with this version."), | |||||
walletFile)); | |||||
return nullptr; | |||||
} | |||||
walletInstance->SetMinVersion(FEATURE_LATEST); | walletInstance->SetMinVersion(FEATURE_LATEST); | ||||
if ((wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { | if ((wallet_creation_flags & WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { | ||||
// selective allow to set flags | // selective allow to set flags | ||||
walletInstance->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS); | walletInstance->SetWalletFlag(WALLET_FLAG_DISABLE_PRIVATE_KEYS); | ||||
} else if (wallet_creation_flags & WALLET_FLAG_BLANK_WALLET) { | } else if (wallet_creation_flags & WALLET_FLAG_BLANK_WALLET) { | ||||
walletInstance->SetWalletFlag(WALLET_FLAG_BLANK_WALLET); | walletInstance->SetWalletFlag(WALLET_FLAG_BLANK_WALLET); | ||||
} else { | } else { | ||||
Show All 22 Lines | if (fFirstRun) { | ||||
WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { | WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { | ||||
LOCK(walletInstance->cs_KeyStore); | LOCK(walletInstance->cs_KeyStore); | ||||
if (!walletInstance->mapKeys.empty() || | if (!walletInstance->mapKeys.empty() || | ||||
!walletInstance->mapCryptedKeys.empty()) { | !walletInstance->mapCryptedKeys.empty()) { | ||||
InitWarning(strprintf(_("Warning: Private keys detected in wallet " | InitWarning(strprintf(_("Warning: Private keys detected in wallet " | ||||
"{%s} with disabled private keys"), | "{%s} with disabled private keys"), | ||||
walletFile)); | walletFile)); | ||||
} | } | ||||
} else if (gArgs.IsArgSet("-usehd")) { | |||||
bool useHD = gArgs.GetBoolArg("-usehd", true); | |||||
if (walletInstance->IsHDEnabled() && !useHD) { | |||||
InitError( | |||||
strprintf(_("Error loading %s: You can't disable HD on an " | |||||
"already existing HD wallet"), | |||||
walletFile)); | |||||
return nullptr; | |||||
} | |||||
if (!walletInstance->IsHDEnabled() && useHD) { | |||||
InitError(strprintf(_("Error loading %s: You can't enable HD on an " | |||||
"already existing non-HD wallet"), | |||||
walletFile)); | |||||
return nullptr; | |||||
} | |||||
} | } | ||||
if (gArgs.IsArgSet("-mintxfee")) { | if (gArgs.IsArgSet("-mintxfee")) { | ||||
Amount n = Amount::zero(); | Amount n = Amount::zero(); | ||||
if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || | if (!ParseMoney(gArgs.GetArg("-mintxfee", ""), n) || | ||||
n == Amount::zero()) { | n == Amount::zero()) { | ||||
InitError(AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", ""))); | InitError(AmountErrMsg("mintxfee", gArgs.GetArg("-mintxfee", ""))); | ||||
return nullptr; | return nullptr; | ||||
▲ Show 20 Lines • Show All 332 Lines • Show Last 20 Lines |