Skip to content

Commit 1775ee6

Browse files
committed
rpd: Fix decimal places handling
1 parent 72c80ae commit 1775ee6

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

src/rpc/util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey);
8181
* Validate and return a CAmount from a UniValue number or string.
8282
*
8383
* @param[in] value UniValue number or string to parse.
84-
* @param[in] decimals Number of significant digits (default: 8).
84+
* @param[in] decimals Number of significant digits (default: 4).
8585
* @returns a CAmount if the various checks pass.
8686
*/
87-
CAmount AmountFromValue(const UniValue& value, int decimals = 8);
87+
CAmount AmountFromValue(const UniValue& value, int decimals = 4);
8888

8989
using RPCArgList = std::vector<std::pair<std::string, UniValue>>;
9090
std::string HelpExampleCli(const std::string& methodname, const std::string& args);

src/wallet/rpcwallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ static void SetFeeEstimateMode(const CWallet& wallet, CCoinControl& cc, const Un
216216
if (!estimate_mode.isNull() && estimate_mode.get_str() != "unset") {
217217
throw JSONRPCError(RPC_INVALID_PARAMETER, "Cannot specify both estimate_mode and fee_rate");
218218
}
219-
// Fee rates in sat/vB cannot represent more than 3 significant digits.
220-
cc.m_feerate = CFeeRate{AmountFromValue(fee_rate, /* decimals */ 3)};
219+
// Fee rates in sat/vB cannot represent more than 2 significant digits.
220+
cc.m_feerate = CFeeRate{AmountFromValue(fee_rate, /* decimals */ 2)};
221221
if (override_min_fee) cc.fOverrideFeeRate = true;
222222
// Default RBF to true for explicit fee_rate, if unset.
223223
if (!cc.m_signal_bip125_rbf) cc.m_signal_bip125_rbf = true;

0 commit comments

Comments
 (0)