erigon-pulse/turbo/adapter/block_getter.go
Alex Sharov 068463dff4
Store transactions individually (#1358)
* Store transactions individually

* Store transactions individually

* save progress

* checkIndex

* merge
2020-11-22 21:25:26 +00:00

25 lines
621 B
Go

package adapter
import (
"github.com/ledgerwatch/turbo-geth/common"
"github.com/ledgerwatch/turbo-geth/core/rawdb"
"github.com/ledgerwatch/turbo-geth/core/types"
"github.com/ledgerwatch/turbo-geth/ethdb"
)
func NewBlockGetter(dbReader ethdb.Database) *blockGetter {
return &blockGetter{dbReader}
}
type blockGetter struct {
dbReader ethdb.Database
}
func (g *blockGetter) GetBlockByHash(hash common.Hash) (*types.Block, error) {
return rawdb.ReadBlockByHash(g.dbReader, hash)
}
func (g *blockGetter) GetBlock(hash common.Hash, number uint64) *types.Block {
return rawdb.ReadBlock(g.dbReader, hash, number)
}