Skip to content

Commit 3be5760

Browse files
committed
LedgerDB.StateMachine test: fix precondition for rollbacks
Previously, it didn't account for rollbacks, so we never generated any.
1 parent 63be310 commit 3be5760

File tree

1 file changed

+3
-1
lines changed
  • ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/LedgerDB

1 file changed

+3
-1
lines changed

ouroboros-consensus/test/storage-test/Test/Ouroboros/Storage/LedgerDB/StateMachine.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ instance StateModel Model where
365365
n <= min (BT.unNonZero $ maxRollbacks secParam) (fromIntegral $ AS.length chain)
366366
&& case blks of
367367
[] -> True
368-
(b : _) -> tbSlot b == 1 + withOrigin 0 id (getTipSlot (AS.headAnchor chain))
368+
(b : _) -> tbSlot b == 1 + fromWithOrigin 0 (getTipSlot (AS.headAnchor chain'))
369+
where
370+
chain' = AS.dropNewest (fromIntegral n) chain
369371
precondition _ Init{} = False
370372
precondition _ _ = True
371373

0 commit comments

Comments
 (0)