erigon-pulse/cmd/rpcdaemon/service/service.go
Igor Mandrigin d05cfa22f6
Make plain state + staged sync the default (#782)
* make plain state + staged sync the default

* remove sync mode flag completely

* one thing

* fix the console

* simplify code

* fix and skip tests

* fixup for console tests
2020-07-25 18:18:18 +01:00

39 lines
874 B
Go

package service
import (
"github.com/ledgerwatch/turbo-geth/cmd/rpcdaemon/commands"
"github.com/ledgerwatch/turbo-geth/ethdb"
"github.com/ledgerwatch/turbo-geth/node"
"github.com/ledgerwatch/turbo-geth/p2p"
"github.com/ledgerwatch/turbo-geth/rpc"
)
var _ node.Service = &RPCDaemonService{}
// RPCDaemonService is used in js console and console tests
type RPCDaemonService struct {
api []rpc.API
db *ethdb.ObjectDatabase
}
func (*RPCDaemonService) Protocols() []p2p.Protocol {
return []p2p.Protocol{}
}
func (r *RPCDaemonService) Start(server *p2p.Server) error {
r.api = commands.GetAPI(r.db.KV(), []string{"eth", "debug"})
return nil
}
func (r *RPCDaemonService) Stop() error {
return nil
}
func (r *RPCDaemonService) APIs() []rpc.API {
return r.api
}
func New(db *ethdb.ObjectDatabase) *RPCDaemonService {
return &RPCDaemonService{[]rpc.API{}, db}
}