aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
Diffstat (limited to 'eth/backend.go')
-rw-r--r--eth/backend.go36
1 files changed, 24 insertions, 12 deletions
diff --git a/eth/backend.go b/eth/backend.go
index abd1214ca..352522f61 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -32,6 +32,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/compiler"
"github.com/ethereum/go-ethereum/common/httpclient"
+ "github.com/ethereum/go-ethereum/common/registrar/ethreg"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/downloader"
@@ -44,7 +45,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
- rpc "github.com/ethereum/go-ethereum/rpc/v2"
+ "github.com/ethereum/go-ethereum/rpc"
)
const (
@@ -121,14 +122,15 @@ type Ethereum struct {
eventMux *event.TypeMux
miner *miner.Miner
- Mining bool
- MinerThreads int
- NatSpec bool
- AutoDAG bool
- PowTest bool
- autodagquit chan bool
- etherbase common.Address
- netVersionId int
+ Mining bool
+ MinerThreads int
+ NatSpec bool
+ AutoDAG bool
+ PowTest bool
+ autodagquit chan bool
+ etherbase common.Address
+ netVersionId int
+ netRPCService *PublicNetAPI
}
func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
@@ -262,12 +264,12 @@ func (s *Ethereum) APIs() []rpc.API {
}, {
Namespace: "eth",
Version: "1.0",
- Service: NewPublicBlockChainAPI(s.BlockChain(), s.ChainDb(), s.EventMux(), s.AccountManager()),
+ Service: NewPublicBlockChainAPI(s.BlockChain(), s.Miner(), s.ChainDb(), s.EventMux(), s.AccountManager()),
Public: true,
}, {
Namespace: "eth",
Version: "1.0",
- Service: NewPublicTransactionPoolAPI(s.TxPool(), s.ChainDb(), s.EventMux(), s.BlockChain(), s.AccountManager()),
+ Service: NewPublicTransactionPoolAPI(s.TxPool(), s.Miner(), s.ChainDb(), s.EventMux(), s.BlockChain(), s.AccountManager()),
Public: true,
}, {
Namespace: "eth",
@@ -307,6 +309,15 @@ func (s *Ethereum) APIs() []rpc.API {
Namespace: "debug",
Version: "1.0",
Service: NewPrivateDebugAPI(s),
+ }, {
+ Namespace: "net",
+ Version: "1.0",
+ Service: s.netRPCService,
+ Public: true,
+ }, {
+ Namespace: "admin",
+ Version: "1.0",
+ Service: ethreg.NewPrivateRegistarAPI(s.BlockChain(), s.ChainDb(), s.TxPool(), s.AccountManager()),
},
}
}
@@ -356,11 +367,12 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
// Start implements node.Service, starting all internal goroutines needed by the
// Ethereum protocol implementation.
-func (s *Ethereum) Start(*p2p.Server) error {
+func (s *Ethereum) Start(srvr *p2p.Server) error {
if s.AutoDAG {
s.StartAutoDAG()
}
s.protocolManager.Start()
+ s.netRPCService = NewPublicNetAPI(srvr, s.NetVersion())
return nil
}