MCPcopy Create free account
hub / github.com/CPChain/chain / RemovePeer

Method RemovePeer

node/api.go:50–63  ·  view source on GitHub ↗

RemovePeer disconnects from a a remote node if the connection exists

(url string)

Source from the content-addressed store, hash-verified

48
49// RemovePeer disconnects from a a remote node if the connection exists
50func (api *PrivateAdminAPI) RemovePeer(url string) (bool, error) {
51 // Make sure the server is running, fail otherwise
52 server := api.node.Server()
53 if server == nil {
54 return false, ErrNodeStopped
55 }
56 // Try to remove the url as a static peer and return
57 node, err := discover.ParseNode(url)
58 if err != nil {
59 return false, fmt.Errorf("invalid enode: %v", err)
60 }
61 server.RemovePeer(node)
62 return true, nil
63}
64
65// PeerEvents creates an RPC subscription which receives peer events from the
66// node's p2p.Server

Callers

nothing calls this directly

Calls 2

ServerMethod · 0.80
RemovePeerMethod · 0.65

Tested by

no test coverage detected