aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/util.cpp
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-04-27 10:54:44 +0200
committerJon Atack <jon@atack.com>2021-05-09 12:50:00 +0200
commit0742c7840f03505597fd2de87db97f12597ef667 (patch)
tree3ec1c0e2202c7b1d09902a7c203671aa5b9449aa /src/rpc/util.cpp
parent8ce3ef57a3e9ad13c0aaa4648e8584241d53592d (diff)
downloadbitcoin-0742c7840f03505597fd2de87db97f12597ef667.tar.xz
rpc: enable passing decimals to AmountFromValue, add doxygen
Diffstat (limited to 'src/rpc/util.cpp')
-rw-r--r--src/rpc/util.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 069669bb3b..7cf25e0c82 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -74,12 +74,12 @@ void RPCTypeCheckObj(const UniValue& o,
}
}
-CAmount AmountFromValue(const UniValue& value)
+CAmount AmountFromValue(const UniValue& value, int decimals)
{
if (!value.isNum() && !value.isStr())
throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string");
CAmount amount;
- if (!ParseFixedPoint(value.getValStr(), 8, &amount))
+ if (!ParseFixedPoint(value.getValStr(), decimals, &amount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
if (!MoneyRange(amount))
throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range");