Last active
December 21, 2018 01:35
-
-
Save zscole/35407b9c6518f3b3e557e9db039be894 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func (c *ctoStruct) makeProtocols(versions []uint) []p2p.Protocol { | |
| protos := make([]p2p.Protocol, canto(versions)) | |
| for i, version := range versions { | |
| version := version | |
| protos[i] = p2p.Protocol{ | |
| Name: "cto", | |
| Version: version, | |
| Length: ProtocolLengths[version], | |
| NodeInfo: c.nodeInfo, | |
| Run: func(p *p2p.Peer, rw p2p.MsgReadWriter) error { | |
| return c.protocolManager.runPeer(version, p, rw) | |
| }, | |
| PeerInfo: func(id enode.ID) interface{} { | |
| if p := c.protocolManager.peers.Peer(fmt.Sprintf("%x", id[:8])); p != nil { | |
| return p.Info() | |
| } | |
| return nil | |
| }, | |
| } | |
| } | |
| return protos | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment