aboutsummaryrefslogtreecommitdiffstats
path: root/eth/backend.go
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-12-16 17:58:01 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2016-01-26 20:51:50 +0800
commit19b2640e89465c1c57f1bbea0274d52d97151f60 (patch)
tree980e063693dae7fa6105646821ee6755b176b6e2 /eth/backend.go
parentf2ab351e8d3b0a4e569ce56f6a4f17725ca5ba65 (diff)
downloaddexon-19b2640e89465c1c57f1bbea0274d52d97151f60.tar.gz
dexon-19b2640e89465c1c57f1bbea0274d52d97151f60.tar.zst
dexon-19b2640e89465c1c57f1bbea0274d52d97151f60.zip
rpc: migrated the RPC insterface to a new reflection based RPC layer
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
}