node_rpc_proxy: fix fork earliest height caching [RYO backport]
xref https://github.com/ryo-currency/ryo-currency/pull/86
This commit is contained in:
parent
0dddfeacc9
commit
10475ab23f
|
@ -146,7 +146,7 @@ boost::optional<std::string> NodeRPCProxy::get_earliest_height(uint8_t version,
|
||||||
CHECK_AND_ASSERT_MES(r, std::string(), "Failed to connect to daemon");
|
CHECK_AND_ASSERT_MES(r, std::string(), "Failed to connect to daemon");
|
||||||
CHECK_AND_ASSERT_MES(resp_t.status != CORE_RPC_STATUS_BUSY, resp_t.status, "Failed to connect to daemon");
|
CHECK_AND_ASSERT_MES(resp_t.status != CORE_RPC_STATUS_BUSY, resp_t.status, "Failed to connect to daemon");
|
||||||
CHECK_AND_ASSERT_MES(resp_t.status == CORE_RPC_STATUS_OK, resp_t.status, "Failed to get hard fork status");
|
CHECK_AND_ASSERT_MES(resp_t.status == CORE_RPC_STATUS_OK, resp_t.status, "Failed to get hard fork status");
|
||||||
m_earliest_height[version] = resp_t.enabled ? resp_t.earliest_height : std::numeric_limits<uint64_t>::max();
|
m_earliest_height[version] = resp_t.earliest_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
earliest_height = m_earliest_height[version];
|
earliest_height = m_earliest_height[version];
|
||||||
|
|
|
@ -8428,7 +8428,7 @@ bool wallet2::use_fork_rules(uint8_t version, int64_t early_blocks) const
|
||||||
result = m_node_rpc_proxy.get_earliest_height(version, earliest_height);
|
result = m_node_rpc_proxy.get_earliest_height(version, earliest_height);
|
||||||
throw_on_rpc_response_error(result, "get_hard_fork_info");
|
throw_on_rpc_response_error(result, "get_hard_fork_info");
|
||||||
|
|
||||||
bool close_enough = height >= earliest_height - early_blocks && earliest_height != std::numeric_limits<uint64_t>::max(); // start using the rules that many blocks beforehand
|
bool close_enough = height >= earliest_height - early_blocks; // start using the rules that many blocks beforehand
|
||||||
if (close_enough)
|
if (close_enough)
|
||||||
LOG_PRINT_L2("Using v" << (unsigned)version << " rules");
|
LOG_PRINT_L2("Using v" << (unsigned)version << " rules");
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue