Skip to content

Commit

Permalink
Merge pull request ethereum#2130 from bas-vk/nodeinfo-format
Browse files Browse the repository at this point in the history
Nodeinfo format Genesis and Header
  • Loading branch information
fjl committed Jan 19, 2016
2 parents 5945a33 + 6e7620a commit e7f6798
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions eth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,18 +750,18 @@ func (self *ProtocolManager) txBroadcastLoop() {
// EthNodeInfo represents a short summary of the Ethereum sub-protocol metadata known
// about the host peer.
type EthNodeInfo struct {
Network int `json:"network"` // Ethereum network ID (0=Olympic, 1=Frontier, 2=Morden)
Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain
Genesis string `json:"genesis"` // SHA3 hash of the host's genesis block
Head string `json:"head"` // SHA3 hash of the host's best owned block
Network int `json:"network"` // Ethereum network ID (0=Olympic, 1=Frontier, 2=Morden)
Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain
Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block
Head common.Hash `json:"head"` // SHA3 hash of the host's best owned block
}

// NodeInfo retrieves some protocol metadata about the running host node.
func (self *ProtocolManager) NodeInfo() *EthNodeInfo {
return &EthNodeInfo{
Network: self.networkId,
Difficulty: self.blockchain.GetTd(self.blockchain.CurrentBlock().Hash()),
Genesis: fmt.Sprintf("%x", self.blockchain.Genesis().Hash()),
Head: fmt.Sprintf("%x", self.blockchain.CurrentBlock().Hash()),
Genesis: self.blockchain.Genesis().Hash(),
Head: self.blockchain.CurrentBlock().Hash(),
}
}

0 comments on commit e7f6798

Please sign in to comment.