Skip to content

Commit

Permalink
Query over single connection in runQueryLeadershipSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jul 30, 2023
1 parent f6cb631 commit f704350
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cardano-cli/src/Cardano/CLI/Run/Legacy/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1426,19 +1426,21 @@ runQueryLeadershipSchedule
$ nextEpochEligibleLeadershipSlots sbe shelleyGenesis
serCurrentEpochState ptclState poolid vrkSkey bpp
eInfo (tip, curentEpoch)

case mJsonOutputFile of
Nothing -> liftIO $ printLeadershipScheduleAsText schedule eInfo (SystemStart $ sgSystemStart shelleyGenesis)
Just (File jsonOutputFile) ->
liftIO $ LBS.writeFile jsonOutputFile $
printLeadershipScheduleAsJson schedule eInfo (SystemStart $ sgSystemStart shelleyGenesis)
writeSchedule mJsonOutputFile eInfo shelleyGenesis schedule
mode ->
pure $ do
left . ShelleyQueryCmdUnsupportedMode $ AnyConsensusMode mode
)
& onLeft (left . ShelleyQueryCmdAcquireFailure)
& onLeft left
where
writeSchedule mOutFile eInfo shelleyGenesis schedule =
case mOutFile of
Nothing -> liftIO $ printLeadershipScheduleAsText schedule eInfo (SystemStart $ sgSystemStart shelleyGenesis)
Just (File jsonOutputFile) ->
liftIO $ LBS.writeFile jsonOutputFile $
printLeadershipScheduleAsJson schedule eInfo (SystemStart $ sgSystemStart shelleyGenesis)

printLeadershipScheduleAsText
:: Set SlotNo
-> EpochInfo (Either Text)
Expand Down

0 comments on commit f704350

Please sign in to comment.