(source *common.ZeroCopySource)
| 52 | } |
| 53 | |
| 54 | func (this *Addr) Deserialization(source *common.ZeroCopySource) error { |
| 55 | count, eof := source.NextUint64() |
| 56 | if eof { |
| 57 | return io.ErrUnexpectedEOF |
| 58 | } |
| 59 | |
| 60 | for i := 0; i < int(count); i++ { |
| 61 | var addr comm.PeerAddr |
| 62 | addr.Time, eof = source.NextInt64() |
| 63 | addr.Services, eof = source.NextUint64() |
| 64 | buf, _ := source.NextBytes(uint64(len(addr.IpAddr[:]))) |
| 65 | copy(addr.IpAddr[:], buf) |
| 66 | addr.Port, eof = source.NextUint16() |
| 67 | addr.ConsensusPort, eof = source.NextUint16() |
| 68 | addr.ID, eof = source.NextUint64() |
| 69 | if eof { |
| 70 | return io.ErrUnexpectedEOF |
| 71 | } |
| 72 | |
| 73 | this.NodeAddrs = append(this.NodeAddrs, addr) |
| 74 | } |
| 75 | |
| 76 | if count > comm.MAX_ADDR_NODE_CNT { |
| 77 | count = comm.MAX_ADDR_NODE_CNT |
| 78 | } |
| 79 | this.NodeAddrs = this.NodeAddrs[:count] |
| 80 | |
| 81 | return nil |
| 82 | } |
nothing calls this directly
no test coverage detected