mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-20 13:37:28 +02:00
Merge adf7843410 into merged_master (Bitcoin PR bitcoin/bitcoin#21786)
This commit is contained in:
commit
9c4837db05
9 changed files with 129 additions and 41 deletions
|
|
@ -79,12 +79,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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue