Skip to content

Commit

Permalink
Merge pull request #470 from IntersectMBO/jordan/return-slot-and-bloc…
Browse files Browse the repository at this point in the history
…k-no-in-foldEpochState

Add `SlotNo` and `BlockNo` parameters to `foldEpochState`'s callback function
  • Loading branch information
Jimbo4350 authored Mar 6, 2024
2 parents 10acff0 + 766bd91 commit 2a46a99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cardano-api/internal/Cardano/Api/LedgerState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,9 @@ foldEpochState
-> s
-- ^ an initial value for the condition state
-> ( AnyNewEpochState
-> StateT s IO LedgerStateCondition
-> SlotNo -- ^ Current (not necessarily the tip) slot number
-> BlockNo -- ^ Current (not necessarily the tip) block number
-> StateT s IO LedgerStateCondition
)
-- ^ Condition you want to check against the new epoch state.
--
Expand Down Expand Up @@ -2020,7 +2022,7 @@ foldEpochState nodeConfigFilePath socketPath validationMode terminationEpoch ini
-- There can be only one place where `takeMVar stateMv` exists otherwise this
-- code will deadlock!
condition <- bracket (takeMVar stateMv) (tryPutMVar stateMv) $ \(_prevCondition, previousState) -> do
updatedState@(!newCondition, !_) <- runStateT (checkCondition newEpochState) previousState
updatedState@(!newCondition, !_) <- runStateT (checkCondition newEpochState slotNo currBlockNo) previousState
putMVar stateMv updatedState
pure newCondition
-- Have we reached the termination epoch?
Expand Down

0 comments on commit 2a46a99

Please sign in to comment.