Skip to content

Commit

Permalink
consensus: handle EBBs in rewindHeaderState
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrisby committed Feb 25, 2020
1 parent ccc8eb1 commit b997eef
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b997eef

Please sign in to comment.