mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2025-07-08 19:01:43 +00:00
daemon: sort alt chains by height
This commit is contained in:
parent
c0bc6d96cd
commit
0605406714
5 changed files with 9 additions and 7 deletions
|
@ -1861,7 +1861,9 @@ bool t_rpc_command_executor::alt_chain_info(const std::string &tip)
|
|||
if (tip.empty())
|
||||
{
|
||||
tools::msg_writer() << boost::lexical_cast<std::string>(res.chains.size()) << " alternate chains found:";
|
||||
for (const auto &chain: res.chains)
|
||||
auto chains = res.chains;
|
||||
std::sort(chains.begin(), chains.end(), [](const cryptonote::COMMAND_RPC_GET_ALTERNATE_CHAINS::chain_info &info0, cryptonote::COMMAND_RPC_GET_ALTERNATE_CHAINS::chain_info &info1){ return info0.height < info1.height; });
|
||||
for (const auto &chain: chains)
|
||||
{
|
||||
uint64_t start_height = (chain.height - chain.length + 1);
|
||||
tools::msg_writer() << chain.length << " blocks long, from height " << start_height << " (" << (ires.height - start_height - 1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue