Version package
(n p2pnet.P2P, height uint32)
| 152 | |
| 153 | //Version package |
| 154 | func 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 |
| 183 | func NewTxnDataReq(hash common.Uint256) mt.Message { |
nothing calls this directly
no test coverage detected