Skip to content

Commit

Permalink
Update leadership-schedule command accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimbo4350 committed Jan 31, 2022
1 parent c62707f commit 2b8b7df
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -902,23 +902,34 @@ runQueryLeadershipSchedule (AnyConsensusModeParams cModeParams) network
& hoistMaybe (ShelleyQueryCmdEraConsensusModeMismatch (AnyConsensusMode cMode) anyE)

let pparamsQuery = QueryInEra eInMode $ QueryInShelleyBasedEra sbe QueryProtocolParameters
serDebugLedgerStateQuery = QueryInEra eInMode . QueryInShelleyBasedEra sbe $ QueryDebugLedgerState
ptclStateQuery = QueryInEra eInMode . QueryInShelleyBasedEra sbe $ QueryProtocolState
eraHistoryQuery = QueryEraHistory CardanoModeIsMultiEra

pparams <- executeQuery era cModeParams localNodeConnInfo pparamsQuery
serDebugLedState <- executeQuery era cModeParams localNodeConnInfo serDebugLedgerStateQuery
ptclState <- executeQuery era cModeParams localNodeConnInfo ptclStateQuery
eraHistory <- firstExceptT ShelleyQueryCmdAcquireFailure . newExceptT $ queryNodeLocalState localNodeConnInfo Nothing eraHistoryQuery
let eInfo = toEpochInfo eraHistory

schedule :: Set SlotNo
<- case whichSchedule of
CurrentEpoch ->
CurrentEpoch -> do
let currentEpochStateQuery = QueryInEra eInMode $ QueryInShelleyBasedEra sbe QueryCurrentEpochState
currentEpochQuery = QueryInEra eInMode $ QueryInShelleyBasedEra sbe QueryEpoch
serCurrentEpochState <- executeQuery era cModeParams localNodeConnInfo currentEpochStateQuery
curentEpoch <- executeQuery era cModeParams localNodeConnInfo currentEpochQuery

firstExceptT ShelleyQueryCmdLeaderShipError $ hoistEither
$ eligibleLeaderSlotsConstaints sbe
$ currentEpochEligibleLeadershipSlots sbe shelleyGenesis eInfo
pparams serDebugLedState ptclState poolid vrkSkey
$ currentEpochEligibleLeadershipSlots
sbe
shelleyGenesis
eInfo
pparams
ptclState
poolid
vrkSkey
serCurrentEpochState
curentEpoch

NextEpoch -> do
let currentEpochStateQuery = QueryInEra eInMode $ QueryInShelleyBasedEra sbe QueryCurrentEpochState
Expand All @@ -932,7 +943,7 @@ runQueryLeadershipSchedule (AnyConsensusModeParams cModeParams) network
$ eligibleLeaderSlotsConstaints sbe
$ nextEpochEligibleLeadershipSlots sbe shelleyGenesis
serCurrentEpochState ptclState poolid vrkSkey pparams
(tip, curentEpoch)
eInfo (tip, curentEpoch)

liftIO $ printLeadershipSchedule schedule eInfo (SystemStart $ sgSystemStart shelleyGenesis)
mode -> left . ShelleyQueryCmdUnsupportedMode $ AnyConsensusMode mode
Expand Down

0 comments on commit 2b8b7df

Please sign in to comment.