aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-01 19:57:34 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-01 19:58:09 +0000
commite9809382109765ce53fcbd95e1fc593d9b19e184 (patch)
treef79bcb4fd4f14e9b262f67c70b4181f6df86b5eb /src/rpc
parentMerge pull request #5486 (diff)
downloadmonero-e9809382109765ce53fcbd95e1fc593d9b19e184.tar.xz
fix wide difficulty conversion with some versions of boost
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/core_rpc_server.cpp4
-rw-r--r--src/rpc/daemon_handler.cpp6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index c41fb37d8..0ad7e59e9 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -74,9 +74,9 @@ namespace
void store_difficulty(cryptonote::difficulty_type difficulty, uint64_t &sdiff, std::string &swdiff, uint64_t &stop64)
{
- sdiff = (difficulty << 64 >> 64).convert_to<uint64_t>();
+ sdiff = (difficulty & 0xffffffffffffffff).convert_to<uint64_t>();
swdiff = cryptonote::hex(difficulty);
- stop64 = (difficulty >> 64).convert_to<uint64_t>();
+ stop64 = ((difficulty >> 64) & 0xffffffffffffffff).convert_to<uint64_t>();
}
}
diff --git a/src/rpc/daemon_handler.cpp b/src/rpc/daemon_handler.cpp
index 7c8953930..c997f6f47 100644
--- a/src/rpc/daemon_handler.cpp
+++ b/src/rpc/daemon_handler.cpp
@@ -437,7 +437,7 @@ namespace rpc
auto& chain = m_core.get_blockchain_storage();
res.info.wide_difficulty = chain.get_difficulty_for_next_block();
- res.info.difficulty = (res.info.wide_difficulty << 64 >> 64).convert_to<uint64_t>();
+ res.info.difficulty = (res.info.wide_difficulty & 0xffffffffffffffff).convert_to<uint64_t>();
res.info.target = chain.get_difficulty_target();
@@ -459,7 +459,7 @@ namespace rpc
res.info.testnet = m_core.get_nettype() == TESTNET;
res.info.stagenet = m_core.get_nettype() == STAGENET;
res.info.wide_cumulative_difficulty = m_core.get_blockchain_storage().get_db().get_block_cumulative_difficulty(res.info.height - 1);
- res.info.cumulative_difficulty = (res.info.wide_cumulative_difficulty << 64 >> 64).convert_to<uint64_t>();
+ res.info.cumulative_difficulty = (res.info.wide_cumulative_difficulty & 0xffffffffffffffff).convert_to<uint64_t>();
res.info.block_size_limit = res.info.block_weight_limit = m_core.get_blockchain_storage().get_current_cumulative_block_weight_limit();
res.info.block_size_median = res.info.block_weight_median = m_core.get_blockchain_storage().get_current_cumulative_block_weight_median();
res.info.start_time = (uint64_t)m_core.get_start_time();
@@ -829,7 +829,7 @@ namespace rpc
}
header.wide_difficulty = m_core.get_blockchain_storage().block_difficulty(header.height);
- header.difficulty = (header.wide_difficulty << 64 >> 64).convert_to<uint64_t>();
+ header.difficulty = (header.wide_difficulty & 0xffffffffffffffff).convert_to<uint64_t>();
return true;
}