Skip to content

Commit 55c1e3d

Browse files
authored
refactor(ledger): use PoolKeyHash for state (#1226)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 6dfab7d commit 55c1e3d

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

internal/test/ledger/ledger.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ func (ls MockLedgerState) StakeRegistration(
6464
}
6565

6666
func (ls MockLedgerState) PoolCurrentState(
67-
poolKeyHash []byte,
67+
poolKeyHash common.PoolKeyHash,
6868
) (*common.PoolRegistrationCertificate, *uint64, error) {
6969
for _, cert := range ls.MockPoolRegistration {
7070
if string(
7171
common.Blake2b224(cert.Operator).Bytes(),
7272
) == string(
73-
poolKeyHash,
73+
common.Blake2b224(poolKeyHash).Bytes(),
7474
) {
7575
// pretend latest registration is current; no retirement support in mock
7676
c := cert

ledger/alonzo/rules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func UtxoValidateValueNotConservedUtxo(
289289
for _, cert := range tx.Certificates() {
290290
switch tmpCert := cert.(type) {
291291
case *common.PoolRegistrationCertificate:
292-
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator).Bytes())
292+
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator))
293293
if err != nil {
294294
return err
295295
}

ledger/babbage/rules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func UtxoValidateValueNotConservedUtxo(
275275
for _, cert := range tx.Certificates() {
276276
switch tmpCert := cert.(type) {
277277
case *common.PoolRegistrationCertificate:
278-
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator).Bytes())
278+
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator))
279279
if err != nil {
280280
return err
281281
}

ledger/common/state.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type PoolState interface {
3535
// PoolCurrentState returns the latest active registration certificate for the given pool key hash.
3636
// It also returns the epoch of a pending retirement certificate, if one exists.
3737
// If the pool is not registered, the registration certificate will be nil.
38-
PoolCurrentState([]byte) (*PoolRegistrationCertificate, *uint64, error)
38+
PoolCurrentState(PoolKeyHash) (*PoolRegistrationCertificate, *uint64, error)
3939
}
4040

4141
// LedgerState defines the interface for querying the ledger

ledger/conway/rules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func UtxoValidateValueNotConservedUtxo(
272272
for _, cert := range tx.Certificates() {
273273
switch tmpCert := cert.(type) {
274274
case *common.PoolRegistrationCertificate:
275-
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator).Bytes())
275+
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator))
276276
if err != nil {
277277
return err
278278
}

ledger/mary/rules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func UtxoValidateValueNotConservedUtxo(
175175
for _, cert := range tx.Certificates() {
176176
switch tmpCert := cert.(type) {
177177
case *common.PoolRegistrationCertificate:
178-
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator).Bytes())
178+
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator))
179179
if err != nil {
180180
return err
181181
}

ledger/shelley/rules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func UtxoValidateValueNotConservedUtxo(
196196
for _, cert := range tx.Certificates() {
197197
switch tmpCert := cert.(type) {
198198
case *common.PoolRegistrationCertificate:
199-
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator).Bytes())
199+
reg, _, err := ls.PoolCurrentState(common.Blake2b224(tmpCert.Operator))
200200
if err != nil {
201201
return err
202202
}

0 commit comments

Comments
 (0)