From b997eef083056e414507e76baedffc793d39fc90 Mon Sep 17 00:00:00 2001 From: Nicolas Frisby Date: Mon, 24 Feb 2020 12:09:24 -0800 Subject: [PATCH] consensus: handle EBBs in rewindHeaderState --- .../src/Ouroboros/Consensus/HeaderValidation.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ouroboros-consensus/src/Ouroboros/Consensus/HeaderValidation.hs b/ouroboros-consensus/src/Ouroboros/Consensus/HeaderValidation.hs index 878313cceb6..bfc8fb7565a 100644 --- a/ouroboros-consensus/src/Ouroboros/Consensus/HeaderValidation.hs +++ b/ouroboros-consensus/src/Ouroboros/Consensus/HeaderValidation.hs @@ -201,12 +201,13 @@ rewindHeaderState cfg p HeaderState{..} = do chainState' <- rewindChainState (configConsensus cfg) headerStateChain p return $ HeaderState { headerStateChain = chainState' - , headerStateTips = Seq.dropWhileR rolledBack headerStateTips + , headerStateTips = Seq.dropWhileR rollBack headerStateTips , headerStateAnchor = headerStateAnchor } where - rolledBack :: AnnTip blk -> Bool - rolledBack t = annTipPoint t > p + rollBack :: AnnTip blk -> Bool + rollBack t = At (annTipSlotNo t) > pointSlot p || + (At (annTipSlotNo t) == pointSlot p && annTipPoint t /= p) {------------------------------------------------------------------------------- Validate header envelope