2525-- These are the main tests for the chain DB. Commands include
2626--
2727-- * Add a block
28- -- * Add a block with a @SlotNo@ that is ahead of the wall-clock.
2928-- * Get the current chain and/or ledger state
3029-- * Create a new iterator and use it to stream blocks
3130-- * Create a new follower and use it to follow the chain
@@ -178,9 +177,7 @@ import Test.Util.WithEq
178177
179178-- | Commands
180179data Cmd blk it flr
181- = -- | Advance the current slot to the block's slot (unless smaller than the
182- -- current slot), add the block and run chain selection.
183- AddBlock blk
180+ = AddBlock blk
184181 | GetCurrentChain
185182 | GetTipBlock
186183 | GetTipHeader
@@ -368,7 +365,6 @@ data ChainDBState m blk = ChainDBState
368365data ChainDBEnv m blk = ChainDBEnv
369366 { varDB :: StrictTVar m (ChainDBState m blk )
370367 , registry :: ResourceRegistry m
371- , varCurSlot :: StrictTVar m SlotNo
372368 , varNextId :: StrictTVar m Id
373369 , varVolatileDbFs :: StrictTMVar m MockFS
374370 , args :: ChainDbArgs Identity m blk
@@ -407,7 +403,7 @@ run ::
407403 m (Success blk (TestIterator m blk ) (TestFollower m blk ))
408404run cfg env@ ChainDBEnv {varDB, .. } cmd =
409405 readTVarIO varDB >>= \ st@ ChainDBState {chainDB = ChainDB {.. }, internal} -> case cmd of
410- AddBlock blk -> Point <$> ( advanceAndAdd st (blockSlot blk) blk)
406+ AddBlock blk -> Point <$> advanceAndAdd st blk
411407 GetCurrentChain -> Chain <$> atomically getCurrentChain
412408 GetTipBlock -> MbBlock <$> getTipBlock
413409 GetTipHeader -> MbHeader <$> getTipHeader
@@ -439,9 +435,8 @@ run cfg env@ChainDBEnv{varDB, ..} cmd =
439435 follower = fmap Flr . giveWithEq
440436 ignore _ = Unit ()
441437
442- advanceAndAdd :: ChainDBState m blk -> SlotNo -> blk -> m (Point blk )
443- advanceAndAdd ChainDBState {chainDB} newCurSlot blk = do
444- atomically $ modifyTVar varCurSlot (max newCurSlot)
438+ advanceAndAdd :: ChainDBState m blk -> blk -> m (Point blk )
439+ advanceAndAdd ChainDBState {chainDB} blk = do
445440 -- `blockProcessed` always returns 'Just'
446441 res <- addBlock chainDB InvalidBlockPunishment. noPunishment blk
447442 ChainDB. triggerChainSelection chainDB
@@ -1606,7 +1601,6 @@ runCmdsLockstep loe (SmallChunkInfo chunkInfo) cmds =
16061601 threadRegistry <- unsafeNewRegistry
16071602 iteratorRegistry <- unsafeNewRegistry
16081603 (tracer, getTrace) <- recordingTracerIORef
1609- varCurSlot <- uncheckedNewTVarM 0
16101604 varNextId <- uncheckedNewTVarM 0
16111605 nodeDBs <- emptyNodeDBs
16121606 varLoEFragment <- newTVarIO $ AF. Empty AF. AnchorGenesis
@@ -1631,7 +1625,6 @@ runCmdsLockstep loe (SmallChunkInfo chunkInfo) cmds =
16311625 ChainDBEnv
16321626 { varDB
16331627 , registry = iteratorRegistry
1634- , varCurSlot
16351628 , varNextId
16361629 , varVolatileDbFs = nodeDBsVol nodeDBs
16371630 , varLoEFragment
0 commit comments