mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-16 18:37:51 +01:00
NodelistLookup function
This commit is contained in:
11
Peer ID.go
11
Peer ID.go
@@ -204,6 +204,17 @@ func PeerlistLookup(publicKey *btcec.PublicKey) (peer *PeerInfo) {
|
||||
return peerList[publicKey2Compressed(publicKey)]
|
||||
}
|
||||
|
||||
// NodelistLookup returns the peer from the list with the node ID
|
||||
func NodelistLookup(nodeID []byte) (peer *PeerInfo) {
|
||||
peerlistMutex.RLock()
|
||||
defer peerlistMutex.RUnlock()
|
||||
|
||||
var nodeID2 [protocol.HashSize]byte
|
||||
copy(nodeID2[:], nodeID)
|
||||
|
||||
return nodeList[nodeID2]
|
||||
}
|
||||
|
||||
// PeerlistCount returns the current count of peers in the peer list
|
||||
func PeerlistCount() (count int) {
|
||||
peerlistMutex.RLock()
|
||||
|
||||
Reference in New Issue
Block a user