Skip to content

Commit

Permalink
fixme: prevent crash after new block is found
Browse files Browse the repository at this point in the history
This doesn't solve the underlying problem.
  • Loading branch information
Sjors committed Sep 19, 2024
1 parent b134f63 commit 765af74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sv2/template_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,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;
}
Expand Down

0 comments on commit 765af74

Please sign in to comment.