aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/server.cpp')
-rw-r--r--src/rpc/server.cpp10
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;