Skip to content

Commit 7dde03f

Browse files
committed
Revalidate epoch_stake after fixing
1 parent 52e9e6e commit 7dde03f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Insert/LedgerEvent.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ insertNewEpochLedgerEvents syncEnv applyRes currentEpochNo@(EpochNo curEpoch) =
7474
handler ev =
7575
case ev of
7676
LedgerNewEpoch en ss -> do
77-
validateEpochStake syncEnv applyRes
77+
validateEpochStake syncEnv applyRes True
7878
databaseCacheSize <- lift DB.queryStatementCacheSize
7979
liftIO . logInfo tracer $ "Database Statement Cache size is " <> textShow databaseCacheSize
8080
currentTime <- liftIO getCurrentTime

cardano-db-sync/src/Cardano/DbSync/Era/Universal/Validate.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ import Cardano.DbSync.Util.Constraint
3434

3535
validateEpochStake ::
3636
SyncEnv ->
37-
ApplyResult -> ExceptT SyncNodeError DB.DbM ()
38-
validateEpochStake syncEnv applyRes = case apOldLedger applyRes of
37+
ApplyResult ->
38+
Bool ->
39+
ExceptT SyncNodeError DB.DbM ()
40+
validateEpochStake syncEnv applyRes firstCall = case apOldLedger applyRes of
3941
Strict.Just lstate | Just (expectedCount, epoch) <- Generic.countEpochStake (clsState lstate) -> do
4042
actualCount <- lift $ DB.queryNormalEpochStakeCount (unEpochNo epoch)
4143
if actualCount /= expectedCount then do
@@ -52,6 +54,7 @@ validateEpochStake syncEnv applyRes = case apOldLedger applyRes of
5254
let slice = Generic.fullEpochStake (clsState lstate)
5355
addStakeConstraintsIfNotExist syncEnv tracer
5456
insertStakeSlice syncEnv slice
57+
when firstCall $ validateEpochStake syncEnv applyRes False
5558
else
5659
liftIO $ logInfo tracer
5760
$ mconcat

0 commit comments

Comments
 (0)