Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/util.cpp
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
Amount AmountFromValue(const UniValue &value) { | Amount AmountFromValue(const UniValue &value) { | ||||
if (!value.isNum() && !value.isStr()) { | if (!value.isNum() && !value.isStr()) { | ||||
throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string"); | throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number or string"); | ||||
} | } | ||||
int64_t n; | int64_t n; | ||||
if (!ParseFixedPoint(value.getValStr(), 8, &n)) { | if (!ParseFixedPoint(value.getValStr(), Currency::get().decimals, &n)) { | ||||
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); | throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); | ||||
} | } | ||||
Amount amt = n * SATOSHI; | Amount amt = n * SATOSHI; | ||||
if (!MoneyRange(amt)) { | if (!MoneyRange(amt)) { | ||||
throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range"); | throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 809 Lines • Show Last 20 Lines |