diff options
| author | Ross Nicoll <[email protected]> | 2018-01-01 16:24:14 +0000 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2018-09-19 19:24:06 +0100 |
| commit | c6eeab75a1c70b6ad63854e036e5843b7f104d31 (patch) | |
| tree | d7e369806b4e5d386820ea031c5cc5083076afbe /src/rpc/server.cpp | |
| parent | Update checkpoints and chain work (#1410) (diff) | |
| download | discoin-c6eeab75a1c70b6ad63854e036e5843b7f104d31.tar.xz discoin-c6eeab75a1c70b6ad63854e036e5843b7f104d31.zip | |
Change count type used by `gettxoutsetinfo` (#1415)
changing CAmount (is a int64_t) to arith_uint256 for nTotalAmount in CCoinsStats to prevent overflow
Diffstat (limited to 'src/rpc/server.cpp')
| -rw-r--r-- | src/rpc/server.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 67fc82580..26e7297f3 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -143,6 +143,16 @@ UniValue ValueFromAmount(const CAmount& amount) strprintf("%s%d.%08d", sign ? "-" : "", quotient, remainder)); } +UniValue ValueFromAmount(const arith_uint256& amount) +{ + bool sign = amount < 0; + arith_uint256 n_abs = (sign ? -amount : amount); + arith_uint256 quotient = n_abs / COIN; + arith_uint256 remainder = n_abs - (quotient * COIN); + return UniValue(UniValue::VNUM, + strprintf("%s%d.%08d", sign ? "-" : "", (int64_t)quotient.getdouble(), (int64_t)remainder.getdouble())); +} + uint256 ParseHashV(const UniValue& v, string strName) { string strHex; |