From a8966035567572fd038c67293d3decd135a6b4d7 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 27 Jun 2018 18:34:15 +0100 Subject: [PATCH] blockchain: set the m_verifivation_failed flag in a couple more places when a block being added to the main chain is invalid. This ensures the peer is banned after a number of these. --- src/cryptonote_core/blockchain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 661bec03a..21f80bfb6 100755 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -3291,6 +3291,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& if(bl.prev_id != get_tail_id()) { MERROR_VER("Block with id: " << id << std::endl << "has wrong prev_id: " << bl.prev_id << std::endl << "expected: " << get_tail_id()); + bvc.m_verifivation_failed = true; leave: m_db->block_txn_stop(); return false; @@ -3591,6 +3592,7 @@ leave: { //TODO: figure out the best way to deal with this failure LOG_ERROR("Error adding block with hash: " << id << " to blockchain, what = " << e.what()); + bvc.m_verifivation_failed = true; return_tx_to_pool(txs); return false; }