Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SlotNo and BlockNo parameters to foldEpochState's callback function #470

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading