aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/rpc_command_executor.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-02 22:23:00 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-09 09:12:49 +0000
commit0605406714b626575d8ea3945504fa5e123399fd (patch)
tree27411a724d612d2ba2a7872513edbfd2ccd4d5a5 /src/daemon/rpc_command_executor.cpp
parentMerge pull request #5509 (diff)
downloadmonero-0605406714b626575d8ea3945504fa5e123399fd.tar.xz
daemon: sort alt chains by height
Diffstat (limited to '')
-rw-r--r--src/daemon/rpc_command_executor.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/daemon/rpc_command_executor.cpp b/src/daemon/rpc_command_executor.cpp
index 151baa33f..054b956ab 100644
--- a/src/daemon/rpc_command_executor.cpp
+++ b/src/daemon/rpc_command_executor.cpp
@@ -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)