aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-11-06 20:10:28 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-11-06 20:10:28 +0800
commitda6696862eff91736ec9a694026a14f984f85f57 (patch)
tree7feb515a65edf50ad5db984723aeef2c2463bee6
parent6d09468cabad74b3b1efabf7ad5a965bdb1aa04a (diff)
parent6e5349880e79b8321ae311d824493e4581039d30 (diff)
downloaddexon-da6696862eff91736ec9a694026a14f984f85f57.tar.gz
dexon-da6696862eff91736ec9a694026a14f984f85f57.tar.zst
dexon-da6696862eff91736ec9a694026a14f984f85f57.zip
Merge pull request #1974 from karalabe/fix-rpc-regression
rpc/api: fix #1972 api regression (nil eth panic) in attach
-rw-r--r--rpc/api/admin.go9
-rw-r--r--rpc/api/utils.go2
2 files changed, 4 insertions, 7 deletions
diff --git a/rpc/api/admin.go b/rpc/api/admin.go
index b359d52a1..c11662577 100644
--- a/rpc/api/admin.go
+++ b/rpc/api/admin.go
@@ -32,7 +32,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/logger/glog"
- "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc/codec"
"github.com/ethereum/go-ethereum/rpc/comms"
@@ -81,17 +80,15 @@ type adminhandler func(*adminApi, *shared.Request) (interface{}, error)
// admin api provider
type adminApi struct {
xeth *xeth.XEth
- network *p2p.Server
ethereum *eth.Ethereum
codec codec.Codec
coder codec.ApiCoder
}
// create a new admin api instance
-func NewAdminApi(xeth *xeth.XEth, network *p2p.Server, ethereum *eth.Ethereum, codec codec.Codec) *adminApi {
+func NewAdminApi(xeth *xeth.XEth, ethereum *eth.Ethereum, codec codec.Codec) *adminApi {
return &adminApi{
xeth: xeth,
- network: network,
ethereum: ethereum,
codec: codec,
coder: codec.New(nil),
@@ -140,11 +137,11 @@ func (self *adminApi) AddPeer(req *shared.Request) (interface{}, error) {
}
func (self *adminApi) Peers(req *shared.Request) (interface{}, error) {
- return self.network.PeersInfo(), nil
+ return self.ethereum.Network().PeersInfo(), nil
}
func (self *adminApi) NodeInfo(req *shared.Request) (interface{}, error) {
- return self.network.NodeInfo(), nil
+ return self.ethereum.Network().NodeInfo(), nil
}
func (self *adminApi) DataDir(req *shared.Request) (interface{}, error) {
diff --git a/rpc/api/utils.go b/rpc/api/utils.go
index 6dde4022b..5a3ade46b 100644
--- a/rpc/api/utils.go
+++ b/rpc/api/utils.go
@@ -165,7 +165,7 @@ func ParseApiString(apistr string, codec codec.Codec, xeth *xeth.XEth, eth *eth.
for i, name := range names {
switch strings.ToLower(strings.TrimSpace(name)) {
case shared.AdminApiName:
- apis[i] = NewAdminApi(xeth, eth.Network(), eth, codec)
+ apis[i] = NewAdminApi(xeth, eth, codec)
case shared.DebugApiName:
apis[i] = NewDebugApi(xeth, eth, codec)
case shared.DbApiName: