diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-10-27 21:10:30 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-10-28 18:44:15 +0800 |
commit | e46ab3bdcde7236c8fe54d6c83655e50bd19fe31 (patch) | |
tree | 4f30c5f9757ebfbde6501e1d53484ff51fd2fad9 /rpc/api | |
parent | 05f74077fb1bc23937f3b25fd4e826dcf5789212 (diff) | |
download | go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.gz go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.bz2 go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.lz go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.xz go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.tar.zst go-tangerine-e46ab3bdcde7236c8fe54d6c83655e50bd19fe31.zip |
eth, p2p, rpc/api: polish protocol info gathering
Diffstat (limited to 'rpc/api')
-rw-r--r-- | rpc/api/admin.go | 9 | ||||
-rw-r--r-- | rpc/api/utils.go | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/rpc/api/admin.go b/rpc/api/admin.go index eb08fbc5d..b359d52a1 100644 --- a/rpc/api/admin.go +++ b/rpc/api/admin.go @@ -32,6 +32,7 @@ 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" @@ -80,15 +81,17 @@ 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, ethereum *eth.Ethereum, codec codec.Codec) *adminApi { +func NewAdminApi(xeth *xeth.XEth, network *p2p.Server, ethereum *eth.Ethereum, codec codec.Codec) *adminApi { return &adminApi{ xeth: xeth, + network: network, ethereum: ethereum, codec: codec, coder: codec.New(nil), @@ -137,11 +140,11 @@ func (self *adminApi) AddPeer(req *shared.Request) (interface{}, error) { } func (self *adminApi) Peers(req *shared.Request) (interface{}, error) { - return self.ethereum.PeersInfo(), nil + return self.network.PeersInfo(), nil } func (self *adminApi) NodeInfo(req *shared.Request) (interface{}, error) { - return self.ethereum.NodeInfo(), nil + return self.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 5a3ade46b..6dde4022b 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, codec) + apis[i] = NewAdminApi(xeth, eth.Network(), eth, codec) case shared.DebugApiName: apis[i] = NewDebugApi(xeth, eth, codec) case shared.DbApiName: |