aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-07-19 13:37:10 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-07-19 13:37:10 -0500
commitd518dae4bf094de36bdf433d2f77f084c6c00162 (patch)
tree64b9c9cfe6a2b20ab5e1702edf083687a8b418a0 /src/cryptonote_core
parentMerge pull request #3854 (diff)
parentalt_chain_info can now give more info about a particular alt chain (diff)
downloadmonero-d518dae4bf094de36bdf433d2f77f084c6c00162.tar.xz
Merge pull request #3973
50af357 alt_chain_info can now give more info about a particular alt chain (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/blockchain.cpp11
-rw-r--r--src/cryptonote_core/blockchain.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index d3c66d091..5d5121504 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -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;
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h
index d52a964c3..d95c8ed15 100644
--- a/src/cryptonote_core/blockchain.h
+++ b/src/cryptonote_core/blockchain.h
@@ -947,7 +947,7 @@ namespace cryptonote
*
* @return a list of chains
*/
- std::list<std::pair<block_extended_info,uint64_t>> get_alternative_chains() const;
+ std::list<std::pair<block_extended_info,std::vector<crypto::hash>>> get_alternative_chains() const;
void add_txpool_tx(transaction &tx, const txpool_tx_meta_t &meta);
void update_txpool_tx(const crypto::hash &txid, const txpool_tx_meta_t &meta);