@@ -77,6 +77,7 @@ unitTests iom knownMigrations =
7777 , test " sync bigger chain" bigChain
7878 , test " rollback while db-sync is off" restartAndRollback
7979 , test " rollback further" rollbackFurther
80+ , test " rollback stake address cache" stakeAddressRollback
8081 ]
8182 , testGroup " different configs"
8283 [ test " genesis config without pool" configNoPools
@@ -323,6 +324,27 @@ rollbackFurther =
323324 where
324325 testLabel = " rollbackFurther"
325326
327+ stakeAddressRollback :: IOManager -> [(Text , Text )] -> Assertion
328+ stakeAddressRollback =
329+ withFullConfig babbageConfig testLabel $ \ interpreter mockServer dbSync -> do
330+ startDBSync dbSync
331+ blk <- forgeNextFindLeaderAndSubmit interpreter mockServer []
332+ blk' <- withBabbageFindLeaderAndSubmit interpreter mockServer $ \ st -> do
333+ let poolId = resolvePool (PoolIndex 0 ) st
334+ tx1 <- Babbage. mkSimpleDCertTx
335+ [ (StakeIndexNew 1 , DCertDeleg . RegKey )
336+ , (StakeIndexNew 1 , \ stCred -> DCertDeleg $ Delegate $ Delegation stCred poolId) ]
337+ st
338+ Right [tx1]
339+ assertBlockNoBackoff dbSync 2
340+ atomically $ rollback mockServer (blockPoint blk)
341+ assertBlockNoBackoff dbSync 1
342+ atomically $ addBlock mockServer blk'
343+ void $ forgeNextFindLeaderAndSubmit interpreter mockServer []
344+ assertBlockNoBackoff dbSync 3
345+ where
346+ testLabel = " stakeAddressRollback"
347+
326348configNoPools :: IOManager -> [(Text , Text )] -> Assertion
327349configNoPools =
328350 withFullConfig " config2" testLabel $ \ _ _ dbSync -> do
0 commit comments