aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-02-28 19:48:10 -0800
committerAlexander Blair <snipa@jagtech.io>2020-02-28 19:48:11 -0800
commit4371ac4265b7abe425697a31f9455d863db04d6b (patch)
tree55640d795da21941ea37d7bd787479bd6e6b0f5c /src/rpc
parentMerge pull request #6224 (diff)
parentprint_coinbase_tx_sum now supports 128 bits sums (diff)
downloadmonero-4371ac4265b7abe425697a31f9455d863db04d6b.tar.xz
Merge pull request #6225
987c3139 print_coinbase_tx_sum now supports 128 bits sums (moneromooo-monero)
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp17
-rw-r--r--src/rpc/core_rpc_server_commands_defs.h8
2 files changed, 19 insertions, 6 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index e3415c65f..4a0f70771 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -125,11 +125,16 @@ namespace
return (value + quantum - 1) / quantum * quantum;
}
+ void store_128(boost::multiprecision::uint128_t value, uint64_t &slow64, std::string &swide, uint64_t &stop64)
+ {
+ slow64 = (value & 0xffffffffffffffff).convert_to<uint64_t>();
+ swide = cryptonote::hex(value);
+ stop64 = ((value >> 64) & 0xffffffffffffffff).convert_to<uint64_t>();
+ }
+
void store_difficulty(cryptonote::difficulty_type difficulty, uint64_t &sdiff, std::string &swdiff, uint64_t &stop64)
{
- sdiff = (difficulty & 0xffffffffffffffff).convert_to<uint64_t>();
- swdiff = cryptonote::hex(difficulty);
- stop64 = ((difficulty >> 64) & 0xffffffffffffffff).convert_to<uint64_t>();
+ store_128(difficulty, sdiff, swdiff, stop64);
}
}
@@ -2499,9 +2504,9 @@ namespace cryptonote
return true;
}
CHECK_PAYMENT_MIN1(req, res, COST_PER_COINBASE_TX_SUM_BLOCK * req.count, false);
- std::pair<uint64_t, uint64_t> amounts = m_core.get_coinbase_tx_sum(req.height, req.count);
- res.emission_amount = amounts.first;
- res.fee_amount = amounts.second;
+ std::pair<boost::multiprecision::uint128_t, boost::multiprecision::uint128_t> amounts = m_core.get_coinbase_tx_sum(req.height, req.count);
+ store_128(amounts.first, res.emission_amount, res.wide_emission_amount, res.emission_amount_top64);
+ store_128(amounts.second, res.fee_amount, res.wide_fee_amount, res.fee_amount_top64);
res.status = CORE_RPC_STATUS_OK;
return true;
}
diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h
index 89e0a6726..dbb1d4472 100644
--- a/src/rpc/core_rpc_server_commands_defs.h
+++ b/src/rpc/core_rpc_server_commands_defs.h
@@ -2023,12 +2023,20 @@ namespace cryptonote
struct response_t: public rpc_access_response_base
{
uint64_t emission_amount;
+ std::string wide_emission_amount;
+ uint64_t emission_amount_top64;
uint64_t fee_amount;
+ std::string wide_fee_amount;
+ uint64_t fee_amount_top64;
BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE_PARENT(rpc_access_response_base)
KV_SERIALIZE(emission_amount)
+ KV_SERIALIZE(wide_emission_amount)
+ KV_SERIALIZE(emission_amount_top64)
KV_SERIALIZE(fee_amount)
+ KV_SERIALIZE(wide_fee_amount)
+ KV_SERIALIZE(fee_amount_top64)
END_KV_SERIALIZE_MAP()
};
typedef epee::misc_utils::struct_init<response_t> response;