diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-12-10 14:48:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-12-10 14:48:39 +0200 |
commit | 0f99423080c22050c9198dc12a8cf908f8f5ecc0 (patch) | |
tree | e20a07d8b3218df2fa0af07b928bfe69e92bac9e | |
parent | Merge pull request #1408 (diff) | |
parent | blockchain: fix setting non trovial alternate chain as invalid (diff) | |
download | monero-0f99423080c22050c9198dc12a8cf908f8f5ecc0.tar.xz |
Merge pull request #1418
dfbb85b6 blockchain: fix setting non trovial alternate chain as invalid (moneromooo-monero)
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 75c38f1cb..efda3f5cf 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -832,12 +832,12 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<blocks_ext_by_hash:: // looking into. add_block_as_invalid(ch_ent->second, get_block_hash(ch_ent->second.bl)); LOG_PRINT_L1("The block was inserted as invalid while connecting new alternative chain, block_id: " << get_block_hash(ch_ent->second.bl)); - m_alternative_chains.erase(ch_ent); + m_alternative_chains.erase(*alt_ch_iter++); - for(auto alt_ch_to_orph_iter = ++alt_ch_iter; alt_ch_to_orph_iter != alt_chain.end(); alt_ch_to_orph_iter++) + for(auto alt_ch_to_orph_iter = alt_ch_iter; alt_ch_to_orph_iter != alt_chain.end(); ) { - add_block_as_invalid((*alt_ch_iter)->second, (*alt_ch_iter)->first); - m_alternative_chains.erase(*alt_ch_to_orph_iter); + add_block_as_invalid((*alt_ch_to_orph_iter)->second, (*alt_ch_to_orph_iter)->first); + m_alternative_chains.erase(*alt_ch_to_orph_iter++); } return false; } |