package wiki import ( nodeconfig "github.com/woop-chain/woop/internal/configs/node" commonRPC "github.com/woop-chain/woop/rpc/common" "github.com/woop-chain/woop/staking/network" "github.com/libp2p/go-libp2p/core/peer" ) // GetCurrentUtilityMetrics .. func (wiki *Woop) GetCurrentUtilityMetrics() (*network.UtilityMetric, error) { return network.NewUtilityMetricSnapshot(wiki.BlockChain) } // GetPeerInfo returns the peer info to the node, including blocked peer, connected peer, number of peers func (wiki *Woop) GetPeerInfo() commonRPC.NodePeerInfo { topics := wiki.NodeAPI.ListTopic() p := make([]commonRPC.P, len(topics)) for i, t := range topics { topicPeer := wiki.NodeAPI.ListPeer(t) p[i].Topic = t p[i].Peers = make([]peer.ID, len(topicPeer)) copy(p[i].Peers, topicPeer) } return commonRPC.NodePeerInfo{ PeerID: nodeconfig.GetPeerID(), BlockedPeers: wiki.NodeAPI.ListBlockedPeer(), P: p, } }