From 1912743dc29beb965884eee58fea40ed6ae452c4 Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Tue, 3 Sep 2024 20:29:24 +0200 Subject: [PATCH] fixme: prevent crash after new block is found This doesn't solve the underlying problem. --- src/node/sv2_template_provider.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/node/sv2_template_provider.cpp b/src/node/sv2_template_provider.cpp index 9e4cda39f6a778..2a960be6bf7bcf 100644 --- a/src/node/sv2_template_provider.cpp +++ b/src/node/sv2_template_provider.cpp @@ -365,6 +365,11 @@ void Sv2TemplateProvider::PruneBlockTemplateCache() // If the blocks prevout is not the tip's prevout, delete it. uint256 prev_hash = m_best_prev_hash; std::erase_if(m_block_template_cache, [prev_hash] (const auto& kv) { + // TODO: this shouldn't happen, but it does. + // Investigate after the mining interface is merged / stable. + // When trying testnet4 mining, using only the pool role, + // the node would crash immediately after finding a block. + if (!kv.second) return true; if (kv.second->getBlockHeader().hashPrevBlock != prev_hash) { return true; }