Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions database/plugin/metadata/sqlite/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import (

// GetPool gets a pool
func (d *MetadataStoreSqlite) GetPool(
// pkh lcommon.PoolKeyHash,
pkh []byte,
pkh lcommon.PoolKeyHash,
txn *gorm.DB,
) (*models.Pool, error) {
ret := &models.Pool{}
Expand All @@ -42,7 +41,7 @@ func (d *MetadataStoreSqlite) GetPool(
First(
ret,
"pool_key_hash = ?",
pkh,
pkh.Bytes(),
)
if result.Error != nil {
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
Expand Down Expand Up @@ -147,7 +146,7 @@ func (d *MetadataStoreSqlite) SetPoolRegistration(
if txn == nil {
txn = d.DB()
}
tmpPool, err := d.GetPool(cert.Operator[:], txn)
tmpPool, err := d.GetPool(lcommon.PoolKeyHash(cert.Operator[:]), txn)
if err != nil {
if !errors.Is(err, models.ErrPoolNotFound) {
return err
Expand Down Expand Up @@ -220,7 +219,7 @@ func (d *MetadataStoreSqlite) SetPoolRetirement(
if txn == nil {
txn = d.DB()
}
tmpPool, err := d.GetPool(cert.PoolKeyHash[:], txn)
tmpPool, err := d.GetPool(lcommon.PoolKeyHash(cert.PoolKeyHash[:]), txn)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion database/plugin/metadata/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type MetadataStore interface {
*gorm.DB,
) ([]lcommon.PoolRegistrationCertificate, error)
GetPool(
[]byte, // pool key hash
lcommon.PoolKeyHash,
*gorm.DB,
) (*models.Pool, error)
GetStakeRegistrations(
Expand Down
3 changes: 2 additions & 1 deletion database/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ package database

import (
"github.com/blinklabs-io/dingo/database/models"
lcommon "github.com/blinklabs-io/gouroboros/ledger/common"
)

// GetPool returns a pool by its key hash
func (d *Database) GetPool(
pkh []byte,
pkh lcommon.PoolKeyHash,
txn *Txn,
) (*models.Pool, error) {
if txn == nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
connectrpc.com/connect v1.19.1
connectrpc.com/grpchealth v1.4.0
connectrpc.com/grpcreflect v1.3.0
github.com/blinklabs-io/gouroboros v0.137.1
github.com/blinklabs-io/gouroboros v0.138.0
github.com/blinklabs-io/ouroboros-mock v0.3.9
github.com/blinklabs-io/plutigo v0.0.13
github.com/dgraph-io/badger/v4 v4.8.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ github.com/bits-and-blooms/bitset v1.20.0 h1:2F+rfL86jE2d/bmw7OhqUg2Sj/1rURkBn3M
github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ=
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/blinklabs-io/gouroboros v0.137.1 h1:4d3Yp50i53JiBUmpCDQQ98Wh2PsBm3HfcV/axjK789U=
github.com/blinklabs-io/gouroboros v0.137.1/go.mod h1:6Gnhu76jzCE0p7zHmQn7TjP8t2MMghF711LgxiuLelg=
github.com/blinklabs-io/gouroboros v0.138.0 h1:yQF18YmC/hOz6g0/z/SdwsLB1bHD8019wQRQPwabUck=
github.com/blinklabs-io/gouroboros v0.138.0/go.mod h1:xwDWF3wRp/9l7uZ6DLfy/OFGdO4GjKomsWmv9i3le6s=
github.com/blinklabs-io/ouroboros-mock v0.3.9 h1:UnciDccJ5tZCR1xI0BcxGZcYjJ/PS5MpnjiiGtrZ680=
github.com/blinklabs-io/ouroboros-mock v0.3.9/go.mod h1:uTkE8/LAYL7yQSntH48Pudf5Xn+jaBWMj+9udbzYXhI=
github.com/blinklabs-io/plutigo v0.0.13 h1:JztPigFmknQmQ3Ti1+mdTY96ihOUDh6wJ3pPnN2YYBU=
Expand Down
2 changes: 1 addition & 1 deletion ledger/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (lv *LedgerView) StakeRegistration(
// It returns the most recent active pool registration certificate
// and the epoch of any pending retirement for the given pool key hash.
func (lv *LedgerView) PoolCurrentState(
pkh []byte,
pkh lcommon.PoolKeyHash,
) (*lcommon.PoolRegistrationCertificate, *uint64, error) {
pool, err := lv.ls.db.GetPool(pkh, lv.txn)
if err != nil {
Expand Down
Loading