erigon-pulse/cmd/rpcdaemon22/commands/bor_api.go
ledgerwatch 8e3ac8a21c
Erigon2 upgrade 2 prototype (#4341)
* Erigon2 upgrade 2 prototype

* Latest erigon-lib

* Fixes

* Fix print

* Fix maxSpan

* Reduce maxSpan

* Remove duplicate joins

* TxNum

* Fix resuming

* first draft of history22

* Introduce historical reads

* Update to erigon-lib

* Update erigon-lib

* Update erigon-lib

* Fixes and tracing for checkChangeSets

* More trace

* Print account details

* fix getHeader

* Update to erigon-lib main

* Add tracer indices and event log indices

* Fix calltracer

* Fix calltracer

* Duplicate rpcdaemon into rpcdaemon22

* Fix tests

* Fix tests

* Fix tests

* Update to latest erigon-lib

Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
2022-06-10 16:18:43 +01:00

38 lines
1.1 KiB
Go

package commands
import (
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/common"
"github.com/ledgerwatch/erigon/consensus/bor"
"github.com/ledgerwatch/erigon/rpc"
)
// BorAPI Bor specific routines
type BorAPI interface {
// Bor snapshot related (see ./bor_snapshot.go)
GetSnapshot(number *rpc.BlockNumber) (*Snapshot, error)
GetAuthor(number *rpc.BlockNumber) (*common.Address, error)
GetSnapshotAtHash(hash common.Hash) (*Snapshot, error)
GetSigners(number *rpc.BlockNumber) ([]common.Address, error)
GetSignersAtHash(hash common.Hash) ([]common.Address, error)
GetCurrentProposer() (common.Address, error)
GetCurrentValidators() ([]*bor.Validator, error)
GetRootHash(start uint64, end uint64) (string, error)
}
// BorImpl is implementation of the BorAPI interface
type BorImpl struct {
*BaseAPI
db kv.RoDB // the chain db
borDb kv.RoDB // the consensus db
}
// NewBorAPI returns BorImpl instance
func NewBorAPI(base *BaseAPI, db kv.RoDB, borDb kv.RoDB) *BorImpl {
return &BorImpl{
BaseAPI: base,
db: db,
borDb: borDb,
}
}