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 14, 2023
1 parent 0b98bad commit d803dd5
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1394,12 +1394,11 @@ runQueryLeadershipSchedule

case whichSchedule of
CurrentEpoch -> do
pure $ do
serCurrentEpochState <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing $ queryPoolDistribution eInMode sbe (Just (Set.singleton poolid)))
& onLeft (left . ShelleyQueryCmdAcquireFailure)
& onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion)
& onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError)
serCurrentEpochState <- lift (queryPoolDistribution eInMode sbe (Just (Set.singleton poolid)))
& onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion)
& onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError)

pure $ do
schedule <- firstExceptT ShelleyQueryCmdLeaderShipError $ hoistEither
$ eligibleLeaderSlotsConstaints sbe
$ currentEpochEligibleLeadershipSlots
Expand All @@ -1416,12 +1415,11 @@ runQueryLeadershipSchedule
writeSchedule mJsonOutputFile eInfo shelleyGenesis schedule

NextEpoch -> do
pure $ do
serCurrentEpochState <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing $ queryCurrentEpochState eInMode sbe)
& onLeft (left . ShelleyQueryCmdAcquireFailure)
& onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion)
& onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError)
serCurrentEpochState <- lift (queryCurrentEpochState eInMode sbe)
& onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion)
& onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError)

pure $ do
tip <- liftIO $ getLocalChainTip localNodeConnInfo

schedule <- firstExceptT ShelleyQueryCmdLeaderShipError $ hoistEither
Expand Down

0 comments on commit d803dd5

Please sign in to comment.