MCPcopy Create free account
hub / github.com/DNAProject/DNA / NewVersion

Function NewVersion

p2pserver/message/msg_pack/msg_pack.go:154–180  ·  view source on GitHub ↗

Version package

(n p2pnet.P2P, height uint32)

Source from the content-addressed store, hash-verified

152
153//Version package
154func NewVersion(n p2pnet.P2P, height uint32) mt.Message {
155 log.Trace()
156 var version mt.Version
157 version.P = mt.VersionPayload{
158 Version: n.GetVersion(),
159 Services: n.GetServices(),
160 SyncPort: n.GetPort(),
161 Nonce: n.GetID(),
162 IsConsensus: false,
163 HttpInfoPort: n.GetHttpInfoPort(),
164 StartHeight: uint64(height),
165 TimeStamp: time.Now().UnixNano(),
166 SoftVersion: config.Version,
167 }
168
169 if n.GetRelay() {
170 version.P.Relay = 1
171 } else {
172 version.P.Relay = 0
173 }
174 if config.DefConfig.P2PNode.HttpInfoPort > 0 {
175 version.P.Cap[msgCommon.HTTP_INFO_FLAG] = 0x01
176 } else {
177 version.P.Cap[msgCommon.HTTP_INFO_FLAG] = 0x00
178 }
179 return &version
180}
181
182//transaction request package
183func NewTxnDataReq(hash common.Uint256) mt.Message {

Callers

nothing calls this directly

Calls 7

TraceFunction · 0.92
GetVersionMethod · 0.65
GetServicesMethod · 0.65
GetPortMethod · 0.65
GetIDMethod · 0.65
GetHttpInfoPortMethod · 0.65
GetRelayMethod · 0.65

Tested by

no test coverage detected