mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-03 17:44:29 +00:00
25 lines
558 B
Go
25 lines
558 B
Go
package adapter
|
|
|
|
import (
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
|
"github.com/ledgerwatch/erigon/common"
|
|
"github.com/ledgerwatch/erigon/core/rawdb"
|
|
"github.com/ledgerwatch/erigon/core/types"
|
|
)
|
|
|
|
func NewBlockGetter(tx kv.Tx) *blockGetter {
|
|
return &blockGetter{tx}
|
|
}
|
|
|
|
type blockGetter struct {
|
|
tx kv.Tx
|
|
}
|
|
|
|
func (g *blockGetter) GetBlockByHash(hash common.Hash) (*types.Block, error) {
|
|
return rawdb.ReadBlockByHash(g.tx, hash)
|
|
}
|
|
|
|
func (g *blockGetter) GetBlock(hash common.Hash, number uint64) *types.Block {
|
|
return rawdb.ReadBlock(g.tx, hash, number)
|
|
}
|