Skip to content

Commit 3fd3fa3

Browse files
committed
Use the new queryPoolState from ledger
1 parent 4235fd7 commit 3fd3fa3

File tree

3 files changed

+12
-21
lines changed

3 files changed

+12
-21
lines changed

cabal.project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ allow-newer:
5959
source-repository-package
6060
type: git
6161
location: https://github.com/IntersectMBO/cardano-ledger
62-
tag: 640fb66d27ac202764de0dda76621c6d57852ba9
63-
--sha256: sha256-2vOUUvY19Emx5UpHNHZnIaWoqI5g3kPgjFQJGm9mVmk=
62+
tag: f6f9e8927cbf3c9d604ca35814d533a0378034dc
63+
--sha256: sha256-LMFLIGXus4NyOcJnZ60rwNgwDLdeXdblVUkjGbpn74c=
6464
subdir:
6565
eras/allegra/impl
6666
eras/alonzo/impl

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/PeerSelection.hs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
module Ouroboros.Consensus.Shelley.Ledger.PeerSelection () where
99

10+
import qualified Cardano.Ledger.Api.State.Query as SL
1011
import Cardano.Ledger.BaseTypes
1112
import qualified Cardano.Ledger.Keys as SL
1213
import qualified Cardano.Ledger.Shelley.API as SL
@@ -52,12 +53,13 @@ instance SL.EraCertState era => LedgerSupportsPeerSelection (ShelleyBlock proto
5253
(futurePoolParams, poolParams) =
5354
(SL.psFutureStakePoolParams pstate, SL.psStakePoolParams pstate)
5455
where
55-
pstate :: SL.PState era
56+
pstate :: SL.PState'
5657
pstate =
57-
view SL.certPStateL
58-
. SL.lsCertState
59-
. SL.esLState
60-
. SL.nesEs
58+
SL.mkPState' id
59+
$ view SL.certPStateL
60+
. SL.lsCertState
61+
. SL.esLState
62+
. SL.nesEs
6163
$ shelleyLedgerState
6264

6365
relayToLedgerRelayAccessPoint :: SL.StakePoolRelay -> Maybe LedgerRelayAccessPoint

ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Query.hs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ data instance BlockQuery (ShelleyBlock proto era) fp result where
243243
BlockQuery
244244
(ShelleyBlock proto era)
245245
QFNoTables
246-
(SL.PState era)
246+
SL.PState'
247247
GetStakeSnapshots ::
248248
Maybe (Set (SL.KeyHash 'SL.StakePool)) ->
249249
BlockQuery
@@ -425,22 +425,11 @@ instance
425425
GetStakePools ->
426426
SL.getPools st
427427
GetStakePoolParams poolids ->
428-
SL.getPoolParameters st poolids
428+
SL.psStakePoolParams $ SL.queryPoolState st $ Just poolids
429429
GetRewardInfoPools ->
430430
SL.getRewardInfoPools globals st
431431
GetPoolState mPoolIds ->
432-
let certPState = view SL.certPStateL . SL.lsCertState . SL.esLState . SL.nesEs $ st
433-
in case mPoolIds of
434-
Just poolIds ->
435-
SL.PState
436-
{ SL.psStakePoolParams =
437-
Map.restrictKeys (SL.psStakePoolParams certPState) poolIds
438-
, SL.psFutureStakePoolParams =
439-
Map.restrictKeys (SL.psFutureStakePoolParams certPState) poolIds
440-
, SL.psRetiring = Map.restrictKeys (SL.psRetiring certPState) poolIds
441-
, SL.psDeposits = Map.restrictKeys (SL.psDeposits certPState) poolIds
442-
}
443-
Nothing -> certPState
432+
SL.queryPoolState st mPoolIds
444433
GetStakeSnapshots mPoolIds ->
445434
let SL.SnapShots
446435
{ SL.ssStakeMark

0 commit comments

Comments
 (0)