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

Method Deserialization

p2pserver/message/types/version.go:72–101  ·  view source on GitHub ↗

Deserialize message payload

(source *comm.ZeroCopySource)

Source from the content-addressed store, hash-verified

70
71//Deserialize message payload
72func (this *Version) Deserialization(source *comm.ZeroCopySource) error {
73 var irregular, eof bool
74 this.P.Version, eof = source.NextUint32()
75 this.P.Services, eof = source.NextUint64()
76 this.P.TimeStamp, eof = source.NextInt64()
77 this.P.SyncPort, eof = source.NextUint16()
78 this.P.HttpInfoPort, eof = source.NextUint16()
79 this.P.ConsPort, eof = source.NextUint16()
80 var buf []byte
81 buf, eof = source.NextBytes(uint64(len(this.P.Cap[:])))
82 copy(this.P.Cap[:], buf)
83
84 this.P.Nonce, eof = source.NextUint64()
85 this.P.StartHeight, eof = source.NextUint64()
86 this.P.Relay, eof = source.NextUint8()
87 this.P.IsConsensus, irregular, eof = source.NextBool()
88 if eof {
89 return io.ErrUnexpectedEOF
90 }
91 if irregular {
92 return comm.ErrIrregularData
93 }
94
95 this.P.SoftVersion, _, irregular, eof = source.NextString()
96 if eof || irregular {
97 this.P.SoftVersion = ""
98 }
99
100 return nil
101}

Callers

nothing calls this directly

Calls 8

NextUint32Method · 0.80
NextUint64Method · 0.80
NextInt64Method · 0.80
NextUint16Method · 0.80
NextUint8Method · 0.80
NextBoolMethod · 0.80
NextStringMethod · 0.80
NextBytesMethod · 0.45

Tested by

no test coverage detected