mirror of
https://github.com/monero-project/monero.git
synced 2025-07-27 22:05:27 -04:00
Merge pull request #3973
50af357
alt_chain_info can now give more info about a particular alt chain (moneromooo-monero)
This commit is contained in:
commit
d518dae4bf
8 changed files with 56 additions and 18 deletions
|
@ -4464,9 +4464,9 @@ std::map<uint64_t, std::tuple<uint64_t, uint64_t, uint64_t>> Blockchain:: get_ou
|
|||
return m_db->get_output_histogram(amounts, unlocked, recent_cutoff, min_count);
|
||||
}
|
||||
|
||||
std::list<std::pair<Blockchain::block_extended_info,uint64_t>> Blockchain::get_alternative_chains() const
|
||||
std::list<std::pair<Blockchain::block_extended_info,std::vector<crypto::hash>>> Blockchain::get_alternative_chains() const
|
||||
{
|
||||
std::list<std::pair<Blockchain::block_extended_info,uint64_t>> chains;
|
||||
std::list<std::pair<Blockchain::block_extended_info,std::vector<crypto::hash>>> chains;
|
||||
|
||||
for (const auto &i: m_alternative_chains)
|
||||
{
|
||||
|
@ -4482,15 +4482,16 @@ std::list<std::pair<Blockchain::block_extended_info,uint64_t>> Blockchain::get_a
|
|||
}
|
||||
if (!found)
|
||||
{
|
||||
uint64_t length = 1;
|
||||
std::vector<crypto::hash> chain;
|
||||
auto h = i.second.bl.prev_id;
|
||||
chain.push_back(top);
|
||||
blocks_ext_by_hash::const_iterator prev;
|
||||
while ((prev = m_alternative_chains.find(h)) != m_alternative_chains.end())
|
||||
{
|
||||
chain.push_back(h);
|
||||
h = prev->second.bl.prev_id;
|
||||
++length;
|
||||
}
|
||||
chains.push_back(std::make_pair(i.second, length));
|
||||
chains.push_back(std::make_pair(i.second, chain));
|
||||
}
|
||||
}
|
||||
return chains;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue