@@ -32,7 +32,6 @@ import (
3232 "github.com/ethereum/go-ethereum/core"
3333 "github.com/ethereum/go-ethereum/core/state"
3434 "github.com/ethereum/go-ethereum/core/types"
35- "github.com/ethereum/go-ethereum/eth"
3635 "github.com/ethereum/go-ethereum/eth/downloader"
3736 "github.com/ethereum/go-ethereum/ethdb"
3837 "github.com/ethereum/go-ethereum/event"
@@ -73,6 +72,7 @@ func errResp(code errCode, format string, v ...interface{}) error {
7372}
7473
7574type BlockChain interface {
75+ Config () * params.ChainConfig
7676 HasHeader (hash common.Hash , number uint64 ) bool
7777 GetHeader (hash common.Hash , number uint64 ) * types.Header
7878 GetHeaderByHash (hash common.Hash ) * types.Header
@@ -1123,12 +1123,23 @@ func (pm *ProtocolManager) txStatus(hashes []common.Hash) []txStatus {
11231123 return stats
11241124}
11251125
1126+ // NodeInfo represents a short summary of the Ethereum sub-protocol metadata
1127+ // known about the host peer.
1128+ type NodeInfo struct {
1129+ Network uint64 `json:"network"` // Ethereum network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
1130+ Difficulty * big.Int `json:"difficulty"` // Total difficulty of the host's blockchain
1131+ Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block
1132+ Config * params.ChainConfig `json:"config"` // Chain configuration for the fork rules
1133+ Head common.Hash `json:"head"` // SHA3 hash of the host's best owned block
1134+ }
1135+
11261136// NodeInfo retrieves some protocol metadata about the running host node.
1127- func (self * ProtocolManager ) NodeInfo () * eth. EthNodeInfo {
1128- return & eth. EthNodeInfo {
1137+ func (self * ProtocolManager ) NodeInfo () * NodeInfo {
1138+ return & NodeInfo {
11291139 Network : self .networkId ,
11301140 Difficulty : self .blockchain .GetTdByHash (self .blockchain .LastBlockHash ()),
11311141 Genesis : self .blockchain .Genesis ().Hash (),
1142+ Config : self .blockchain .Config (),
11321143 Head : self .blockchain .LastBlockHash (),
11331144 }
11341145}
0 commit comments