| 115 | } |
| 116 | |
| 117 | CAmount AmountFromValue(const UniValue& value) |
| 118 | { |
| 119 | if (!value.isReal() && !value.isNum()) |
| 120 | throw JSONRPCError(RPC_TYPE_ERROR, "Amount is not a number"); |
| 121 | CAmount amount; |
| 122 | if (!ParseFixedPoint(value.getValStr(), 8, &amount)) |
| 123 | throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); |
| 124 | if (!MoneyRange(amount)) |
| 125 | throw JSONRPCError(RPC_TYPE_ERROR, "Amount out of range"); |
| 126 | return amount; |
| 127 | } |
| 128 | |
| 129 | uint256 ParseHashV(const UniValue& v, string strName) |
| 130 | { |