mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2025-07-11 03:45:07 +00:00
rpc: new function and RPC to get alternative chain info
This commit is contained in:
parent
29735c8f8f
commit
55fa0479a0
10 changed files with 147 additions and 0 deletions
|
@ -1337,6 +1337,24 @@ namespace cryptonote
|
|||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_get_alternate_chains(const COMMAND_RPC_GET_ALTERNATE_CHAINS::request& req, COMMAND_RPC_GET_ALTERNATE_CHAINS::response& res, epee::json_rpc::error& error_resp)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::list<std::pair<Blockchain::block_extended_info, uint64_t>> chains = m_core.get_blockchain_storage().get_alternative_chains();
|
||||
for (const auto &i: chains)
|
||||
{
|
||||
res.chains.push_back(COMMAND_RPC_GET_ALTERNATE_CHAINS::chain_info{epee::string_tools::pod_to_hex(get_block_hash(i.first.bl)), i.first.height, i.second, i.first.cumulative_difficulty});
|
||||
}
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
res.status = "Error retrieving alternate chains";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_out_peers(const COMMAND_RPC_OUT_PEERS::request& req, COMMAND_RPC_OUT_PEERS::response& res)
|
||||
{
|
||||
// TODO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue