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 10, 2024
1 parent 04befbd commit 598f08a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/node/sv2_template_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 598f08a

Please sign in to comment.