From 3406cf78b48a6b6860e16cfc9449a3490cd5c0b7 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Wed, 11 May 2022 15:07:54 +0200 Subject: [PATCH] Don't return stale chain tip to other peers --- src/side_chain.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/side_chain.cpp b/src/side_chain.cpp index a127228..62ea654 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -584,8 +584,13 @@ bool SideChain::get_block_blob(const hash& id, std::vector& blob) const PoolBlock* block = nullptr; // Empty hash means we return current sidechain tip - if (id == hash()) { + if (id.empty()) { block = m_chainTip; + + // Don't return stale chain tip + if (block && (block->m_txinGenHeight + 2 < m_pool->miner_data().height)) { + return false; + } } else { auto it = m_blocksById.find(id);