Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/init.cpp
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | bool WalletInit::ParameterInteraction() const { | ||||
if (gArgs.GetBoolArg("-sysperms", false)) { | if (gArgs.GetBoolArg("-sysperms", false)) { | ||||
return InitError("-sysperms is not allowed in combination with enabled " | return InitError("-sysperms is not allowed in combination with enabled " | ||||
"wallet functionality"); | "wallet functionality"); | ||||
} | } | ||||
if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false)) { | if (gArgs.GetArg("-prune", 0) && gArgs.GetBoolArg("-rescan", false)) { | ||||
return InitError( | return InitError( | ||||
_("Rescans are not possible in pruned mode. You will need to use " | _("Rescans are not possible in pruned mode. You will need to use " | ||||
"-reindex which will download the whole blockchain again.")); | "-reindex which will download the whole blockchain again.") | ||||
.translated); | |||||
} | } | ||||
if (minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB) { | if (minRelayTxFee.GetFeePerK() > HIGH_TX_FEE_PER_KB) { | ||||
InitWarning( | InitWarning( | ||||
AmountHighWarn("-minrelaytxfee") + " " + | AmountHighWarn("-minrelaytxfee") + " " + | ||||
_("The wallet will avoid paying less than the minimum relay fee.")); | _("The wallet will avoid paying less than the minimum relay fee.") | ||||
.translated); | |||||
} | } | ||||
if (gArgs.IsArgSet("-maxtxfee")) { | if (gArgs.IsArgSet("-maxtxfee")) { | ||||
Amount nMaxFee = Amount::zero(); | Amount nMaxFee = Amount::zero(); | ||||
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) { | if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee)) { | ||||
return InitError( | return InitError( | ||||
AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", ""))); | AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", ""))); | ||||
} | } | ||||
if (nMaxFee > HIGH_MAX_TX_FEE) { | if (nMaxFee > HIGH_MAX_TX_FEE) { | ||||
InitWarning(_("-maxtxfee is set very high! Fees this large could " | InitWarning(_("-maxtxfee is set very high! Fees this large could " | ||||
"be paid on a single transaction.")); | "be paid on a single transaction.") | ||||
.translated); | |||||
} | } | ||||
maxTxFee = nMaxFee; | maxTxFee = nMaxFee; | ||||
if (CFeeRate(maxTxFee, 1000) < minRelayTxFee) { | if (CFeeRate(maxTxFee, 1000) < minRelayTxFee) { | ||||
return InitError(strprintf( | return InitError(strprintf( | ||||
_("Invalid amount for -maxtxfee=<amount>: '%s' (must " | _("Invalid amount for -maxtxfee=<amount>: '%s' (must " | ||||
"be at least the minrelay fee of %s to prevent " | "be at least the minrelay fee of %s to prevent " | ||||
"stuck transactions)"), | "stuck transactions)") | ||||
.translated, | |||||
gArgs.GetArg("-maxtxfee", ""), minRelayTxFee.ToString())); | gArgs.GetArg("-maxtxfee", ""), minRelayTxFee.ToString())); | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
void WalletInit::Construct(InitInterfaces &interfaces) const { | void WalletInit::Construct(InitInterfaces &interfaces) const { | ||||
if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | if (gArgs.GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET)) { | ||||
LogPrintf("Wallet disabled!\n"); | LogPrintf("Wallet disabled!\n"); | ||||
return; | return; | ||||
} | } | ||||
gArgs.SoftSetArg("-wallet", ""); | gArgs.SoftSetArg("-wallet", ""); | ||||
interfaces.chain_clients.emplace_back(interfaces::MakeWalletClient( | interfaces.chain_clients.emplace_back(interfaces::MakeWalletClient( | ||||
*interfaces.chain, gArgs.GetArgs("-wallet"))); | *interfaces.chain, gArgs.GetArgs("-wallet"))); | ||||
} | } |