Skip to content

Commit 634e844

Browse files
committed
LedgerDB.StateMachine test: proper bookkeeping for rollbacks
Otherwise, the chain used on `DropAndRestore` gets malformed when there are non-trivial rollbacks.
1 parent 3be5760 commit 634e844

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
@@ -553,7 +553,9 @@ instance RunModel Model (StateT Environment IO) where
553553
vr <- validateFork ldb rr (const $ pure ()) BlockCache.empty n (map getHeader blks)
554554
case vr of
555555
ValidateSuccessful forker -> do
556-
atomically $ modifyTVar (dbChain chainDb) (reverse (map blockRealPoint blks) ++)
556+
atomically $
557+
modifyTVar (dbChain chainDb) $
558+
(reverse (map blockRealPoint blks) ++) . drop (fromIntegral n)
557559
atomically (forkerCommit forker)
558560
forkerClose forker
559561
ValidateExceededRollBack{} -> error "Unexpected Rollback"

0 commit comments

Comments
 (0)