Skip to content

Commit dfbf117

Browse files
committed
Move maxTxFee initialization to init.cpp
1 parent 1a60369 commit dfbf117

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/init.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,22 @@ bool AppInitParameterInteraction()
10981098
dustRelayFee = CFeeRate(n);
10991099
}
11001100

1101+
// This is required by both the wallet and node
1102+
if (gArgs.IsArgSet("-maxtxfee"))
1103+
{
1104+
CAmount nMaxFee = 0;
1105+
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee))
1106+
return InitError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")));
1107+
if (nMaxFee > HIGH_MAX_TX_FEE)
1108+
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
1109+
maxTxFee = nMaxFee;
1110+
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
1111+
{
1112+
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
1113+
gArgs.GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
1114+
}
1115+
}
1116+
11011117
fRequireStandard = !gArgs.GetBoolArg("-acceptnonstdtxn", !chainparams.RequireStandard());
11021118
if (chainparams.RequireStandard() && !fRequireStandard)
11031119
return InitError(strprintf("acceptnonstdtxn is not currently supported for %s chain", chainparams.NetworkIDString()));

src/wallet/init.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,6 @@ bool WalletInit::ParameterInteraction() const
127127
InitWarning(AmountHighWarn("-minrelaytxfee") + " " +
128128
_("The wallet will avoid paying less than the minimum relay fee."));
129129

130-
if (gArgs.IsArgSet("-maxtxfee"))
131-
{
132-
CAmount nMaxFee = 0;
133-
if (!ParseMoney(gArgs.GetArg("-maxtxfee", ""), nMaxFee))
134-
return InitError(AmountErrMsg("maxtxfee", gArgs.GetArg("-maxtxfee", "")));
135-
if (nMaxFee > HIGH_MAX_TX_FEE)
136-
InitWarning(_("-maxtxfee is set very high! Fees this large could be paid on a single transaction."));
137-
maxTxFee = nMaxFee;
138-
if (CFeeRate(maxTxFee, 1000) < ::minRelayTxFee)
139-
{
140-
return InitError(strprintf(_("Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay fee of %s to prevent stuck transactions)"),
141-
gArgs.GetArg("-maxtxfee", ""), ::minRelayTxFee.ToString()));
142-
}
143-
}
144-
145130
return true;
146131
}
147132

0 commit comments

Comments
 (0)