You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge bitcoin#15770: rpc: Validate maxfeerate with AmountFromValue
aa410c2 rpc: Validate maxfeerate with AmountFromValue (João Barbosa)
Pull request description:
With this change `maxfeerate` can also be set as a string, accordingly to the help test:
```
maxfeerate (numeric or string,
```
Beside, there are no tests for the removed errors.
ACKs for commit aa410c:
meshcollider:
utACK bitcoin@aa410c2
MarcoFalke:
utACK aa410c2 Good catch
Tree-SHA512: f3bfea91dc7daa943729e270585dbf333055aeda805fbd01eaab20a7e0e6147382647c11525334382d198df0d3d45da6102b541efda5a1361f96271c98d5d89d
// TODO: temporary migration code for old clients. Remove in v0.20
819
819
if (request.params[1].isBool()) {
820
820
throwJSONRPCError(RPC_INVALID_PARAMETER, "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.");
821
-
} elseif (request.params[1].isNum()) {
821
+
} elseif (!request.params[1].isNull()) {
822
822
size_t weight = GetTransactionWeight(*tx);
823
823
CFeeRate fr(AmountFromValue(request.params[1]));
824
824
// the +3/4 part rounds the value up, and is the same formula used when
825
825
// calculating the fee for a transaction
826
826
// (see GetVirtualTransactionSize)
827
827
max_raw_tx_fee = fr.GetFee((weight+3)/4);
828
-
} elseif (!request.params[1].isNull()) {
829
-
throwJSONRPCError(RPC_INVALID_PARAMETER, "second argument (maxfeerate) must be numeric");
// TODO: temporary migration code for old clients. Remove in v0.20
901
899
if (request.params[1].isBool()) {
902
900
throwJSONRPCError(RPC_INVALID_PARAMETER, "Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.");
903
-
} elseif (request.params[1].isNum()) {
901
+
} elseif (!request.params[1].isNull()) {
904
902
size_t weight = GetTransactionWeight(*tx);
905
903
CFeeRate fr(AmountFromValue(request.params[1]));
906
904
// the +3/4 part rounds the value up, and is the same formula used when
907
905
// calculating the fee for a transaction
908
906
// (see GetVirtualTransactionSize)
909
907
max_raw_tx_fee = fr.GetFee((weight+3)/4);
910
-
} elseif (!request.params[1].isNull()) {
911
-
throwJSONRPCError(RPC_INVALID_PARAMETER, "second argument (maxfeerate) must be numeric");
0 commit comments