erigon-pulse/cmd/rpcdaemon/service/service.go

24 lines
782 B
Go
Raw Normal View History

package service
import (
"context"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/cli"
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/commands"
2021-03-23 09:00:07 +00:00
"github.com/ledgerwatch/turbo-geth/consensus"
"github.com/ledgerwatch/turbo-geth/consensus/ethash"
"github.com/ledgerwatch/turbo-geth/core"
"github.com/ledgerwatch/turbo-geth/ethdb"
"github.com/ledgerwatch/turbo-geth/node"
)
2021-03-30 09:53:54 +00:00
func New(db ethdb.RoKV, ethereum core.EthBackend, engine consensus.Engine, stack *node.Node) {
2021-03-23 09:00:07 +00:00
var ethashApi *ethash.API
if casted, ok := engine.(*ethash.Ethash); !ok {
ethashApi = casted.APIs(nil)[1].Service.(*ethash.API)
}
apis := commands.APIList(context.TODO(), db, core.NewEthBackend(ethereum, ethashApi), nil, cli.Flags{API: []string{"eth", "debug"}}, nil)
2020-08-15 17:32:05 +00:00
stack.RegisterAPIs(apis)
}