[rpc] added current block number in utility metadata

pull/3667/head
Jacky Wang 4 years ago
parent 343dbe89b3
commit 6705e233ee
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 33
      hmy/hmy.go
  2. 33
      rpc/common/types.go

@ -191,22 +191,23 @@ func (hmy *Harmony) GetNodeMetadata() commonRPC.NodeMetadata {
consensusInternal := hmy.NodeAPI.GetConsensusInternal()
return commonRPC.NodeMetadata{
BLSPublicKey: blsKeys,
Version: nodeconfig.GetVersion(),
NetworkType: string(cfg.GetNetworkType()),
ChainConfig: *hmy.ChainConfig(),
IsLeader: hmy.IsLeader(),
ShardID: hmy.ShardID,
CurrentEpoch: header.Epoch().Uint64(),
BlocksPerEpoch: blockEpoch,
Role: cfg.Role().String(),
DNSZone: cfg.DNSZone,
Archival: cfg.GetArchival(),
NodeBootTime: hmy.NodeAPI.GetNodeBootTime(),
PeerID: nodeconfig.GetPeerID(),
Consensus: consensusInternal,
C: c,
SyncPeers: syncPeers,
BLSPublicKey: blsKeys,
Version: nodeconfig.GetVersion(),
NetworkType: string(cfg.GetNetworkType()),
ChainConfig: *hmy.ChainConfig(),
IsLeader: hmy.IsLeader(),
ShardID: hmy.ShardID,
CurrentBlockNum: header.Number().Uint64(),
CurrentEpoch: header.Epoch().Uint64(),
BlocksPerEpoch: blockEpoch,
Role: cfg.Role().String(),
DNSZone: cfg.DNSZone,
Archival: cfg.GetArchival(),
NodeBootTime: hmy.NodeAPI.GetNodeBootTime(),
PeerID: nodeconfig.GetPeerID(),
Consensus: consensusInternal,
C: c,
SyncPeers: syncPeers,
}
}

@ -49,22 +49,23 @@ type ConsensusInternal struct {
// NodeMetadata captures select metadata of the RPC answering node
type NodeMetadata struct {
BLSPublicKey []string `json:"blskey"`
Version string `json:"version"`
NetworkType string `json:"network"`
ChainConfig params.ChainConfig `json:"chain-config"`
IsLeader bool `json:"is-leader"`
ShardID uint32 `json:"shard-id"`
CurrentEpoch uint64 `json:"current-epoch"`
BlocksPerEpoch *uint64 `json:"blocks-per-epoch,omitempty"`
Role string `json:"role"`
DNSZone string `json:"dns-zone"`
Archival bool `json:"is-archival"`
NodeBootTime int64 `json:"node-unix-start-time"`
PeerID peer.ID `json:"peerid"`
Consensus ConsensusInternal `json:"consensus"`
C C `json:"p2p-connectivity"`
SyncPeers map[string]int `json:"sync-peers",omitempty`
BLSPublicKey []string `json:"blskey"`
Version string `json:"version"`
NetworkType string `json:"network"`
ChainConfig params.ChainConfig `json:"chain-config"`
IsLeader bool `json:"is-leader"`
ShardID uint32 `json:"shard-id"`
CurrentBlockNum uint64 `json:"current-number"`
CurrentEpoch uint64 `json:"current-epoch"`
BlocksPerEpoch *uint64 `json:"blocks-per-epoch,omitempty"`
Role string `json:"role"`
DNSZone string `json:"dns-zone"`
Archival bool `json:"is-archival"`
NodeBootTime int64 `json:"node-unix-start-time"`
PeerID peer.ID `json:"peerid"`
Consensus ConsensusInternal `json:"consensus"`
C C `json:"p2p-connectivity"`
SyncPeers map[string]int `json:"sync-peers",omitempty`
}
// P captures the connected peers per topic

Loading…
Cancel
Save