MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / LoadWalletArgs

Method LoadWalletArgs

src/wallet/wallet.cpp:2976–3100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2974}
2975
2976bool CWallet::LoadWalletArgs(std::shared_ptr<CWallet> wallet, const WalletContext& context, bilingual_str& error, std::vector<bilingual_str>& warnings)
2977{
2978 interfaces::Chain* chain = context.chain;
2979 const ArgsManager& args = *Assert(context.args);
2980
2981 if (!args.GetArg("-addresstype", "").empty()) {
2982 std::optional<OutputType> parsed = ParseOutputType(args.GetArg("-addresstype", ""));
2983 if (!parsed) {
2984 error = strprintf(_("Unknown address type '%s'"), args.GetArg("-addresstype", ""));
2985 return false;
2986 }
2987 wallet->m_default_address_type = parsed.value();
2988 }
2989
2990 if (!args.GetArg("-changetype", "").empty()) {
2991 std::optional<OutputType> parsed = ParseOutputType(args.GetArg("-changetype", ""));
2992 if (!parsed) {
2993 error = strprintf(_("Unknown change type '%s'"), args.GetArg("-changetype", ""));
2994 return false;
2995 }
2996 wallet->m_default_change_type = parsed.value();
2997 }
2998
2999 if (const auto arg{args.GetArg("-mintxfee")}) {
3000 std::optional<CAmount> min_tx_fee = ParseMoney(*arg);
3001 if (!min_tx_fee) {
3002 error = AmountErrMsg("mintxfee", *arg);
3003 return false;
3004 } else if (min_tx_fee.value() > HIGH_TX_FEE_PER_KB) {
3005 warnings.push_back(AmountHighWarn("-mintxfee") + Untranslated(" ") +
3006 _("This is the minimum transaction fee you pay on every transaction."));
3007 }
3008
3009 wallet->m_min_fee = CFeeRate{min_tx_fee.value()};
3010 }
3011
3012 if (const auto arg{args.GetArg("-maxapsfee")}) {
3013 const std::string& max_aps_fee{*arg};
3014 if (max_aps_fee == "-1") {
3015 wallet->m_max_aps_fee = -1;
3016 } else if (std::optional<CAmount> max_fee = ParseMoney(max_aps_fee)) {
3017 if (max_fee.value() > HIGH_APS_FEE) {
3018 warnings.push_back(AmountHighWarn("-maxapsfee") + Untranslated(" ") +
3019 _("This is the maximum transaction fee you pay (in addition to the normal fee) to prioritize partial spend avoidance over regular coin selection."));
3020 }
3021 wallet->m_max_aps_fee = max_fee.value();
3022 } else {
3023 error = AmountErrMsg("maxapsfee", max_aps_fee);
3024 return false;
3025 }
3026 }
3027
3028 if (const auto arg{args.GetArg("-fallbackfee")}) {
3029 std::optional<CAmount> fallback_fee = ParseMoney(*arg);
3030 if (!fallback_fee) {
3031 error = strprintf(_("Invalid amount for %s=<amount>: '%s'"), "-fallbackfee", *arg);
3032 return false;
3033 } else if (fallback_fee.value() > HIGH_TX_FEE_PER_KB) {

Callers

nothing calls this directly

Calls 15

ParseOutputTypeFunction · 0.85
_Function · 0.85
ParseMoneyFunction · 0.85
AmountErrMsgFunction · 0.85
AmountHighWarnFunction · 0.85
UntranslatedFunction · 0.85
GetArgMethod · 0.80
GetFeePerKMethod · 0.80
relayMinFeeMethod · 0.80
GetBoolArgMethod · 0.80
CFeeRateClass · 0.70

Tested by

no test coverage detected