diff options
author | Mark Friedenbach <mark@friedenbach.org> | 2014-04-22 15:46:19 -0700 |
---|---|---|
committer | Mark Friedenbach <mark@blockstream.io> | 2014-09-26 15:42:04 -0700 |
commit | a372168e77a8a195613a02983f2589252698bf0f (patch) | |
tree | b300a5f7aa007645c6ba2bd708e7a962fab2894b /src/rpcserver.cpp | |
parent | 64cfaf891fe539b36f6be37dac6c28a712d70b96 (diff) |
Use a typedef for monetary values
Diffstat (limited to 'src/rpcserver.cpp')
-rw-r--r-- | src/rpcserver.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp index 190de62282..1a41344da5 100644 --- a/src/rpcserver.cpp +++ b/src/rpcserver.cpp @@ -88,18 +88,18 @@ static inline int64_t roundint64(double d) return (int64_t)(d > 0 ? d + 0.5 : d - 0.5); } -int64_t AmountFromValue(const Value& value) +CAmount AmountFromValue(const Value& value) { double dAmount = value.get_real(); if (dAmount <= 0.0 || dAmount > 21000000.0) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); - int64_t nAmount = roundint64(dAmount * COIN); + CAmount nAmount = roundint64(dAmount * COIN); if (!MoneyRange(nAmount)) throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount"); return nAmount; } -Value ValueFromAmount(int64_t amount) +Value ValueFromAmount(const CAmount& amount) { return (double)amount / (double)COIN; } |