package eth import ( "context" "errors" "github.com/ethereum/go-ethereum/consensus/bor" "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/event" ) // GetRootHash returns root hash for given start and end block func (b *EthAPIBackend) GetRootHash(ctx context.Context, starBlockNr uint64, endBlockNr uint64) (string, error) { var api *bor.API for _, _api := range b.eth.Engine().APIs(b.eth.BlockChain()) { if _api.Namespace == "bor" { api = _api.Service.(*bor.API) } } if api == nil { return "", errors.New("Only available in Bor engine") } root, err := api.GetRootHash(starBlockNr, endBlockNr) if err != nil { return "", err } return root, nil } // SubscribeStateSyncEvent subscribes to state sync event func (b *EthAPIBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription { return b.eth.BlockChain().SubscribeStateSyncEvent(ch) }