From 6a5d35ebe7923c2554426a746013cd538f849736 Mon Sep 17 00:00:00 2001 From: mfrankovi Date: Mon, 6 Mar 2023 09:03:00 +0100 Subject: [PATCH] fix: missing tip block on tips selection --- .../consensus/src/dag/dag_block_proposer.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/core_libs/consensus/src/dag/dag_block_proposer.cpp b/libraries/core_libs/consensus/src/dag/dag_block_proposer.cpp index 113eb9d229..416a8f6906 100644 --- a/libraries/core_libs/consensus/src/dag/dag_block_proposer.cpp +++ b/libraries/core_libs/consensus/src/dag/dag_block_proposer.cpp @@ -264,10 +264,14 @@ vec_blk_t DagBlockProposer::selectDagBlockTips(const vec_blk_t& frontier_tips, u // Retrieve all the tips blocks and identify duplicate proposer tips for (const auto& t : frontier_tips) { auto tip_block = dag_mgr_->getDagBlock(t); - assert(tip_block != nullptr); - tips_blocks.insert({t, tip_block}); - if (!proposers.insert(tip_block->getSender()).second) { - duplicate_proposers.insert(tip_block->getSender()); + if (tip_block == nullptr) { + // This could happen if a tip block has expired, exclude this tip + LOG(log_nf_) << "selectDagBlockTips, Cannot find tip dag block " << tip_block; + } else { + tips_blocks.insert({t, tip_block}); + if (!proposers.insert(tip_block->getSender()).second) { + duplicate_proposers.insert(tip_block->getSender()); + } } }