func (this *Version) WriteTo(w io.Writer) (int64, error) { var dw dataio.DataWriter dw.Init(w) err := dw.WriteInt32(this.Version) if err != nil { return dw.Count(), err } err = dw.WriteUint64(this.Services) if err != nil { return dw.Count(), err } err = dw.WriteTime64(this.Time) if err != nil { return dw.Count(), err } err = dw.WriteWriterTo(&this.Receive) if err != nil { return dw.Count(), err } err = dw.WriteWriterTo(&this.From) if err != nil { return dw.Count(), err } err = dw.WriteUint64(this.Nonce) if err != nil { return dw.Count(), err } err = dw.WriteVarString(this.UserAgent) if err != nil { return dw.Count(), err } err = dw.WriteInt32(this.StartHeight) if err != nil { return dw.Count(), err } return dw.Count(), nil }
func (this *NetworkAddress) WriteTo(w io.Writer) (int64, error) { var dw dataio.DataWriter dw.Init(w) err := dw.WriteTime32(this.Time) if err != nil { return dw.Count(), err } err = dw.WriteWriterTo(&this.VersionNetworkAddress) if err != nil { return dw.Count(), err } return dw.Count(), nil }
func (this *Tx) WriteTo(w io.Writer) (int64, error) { if this.Version > 2 { return 0, UnsupportedTxVersionError(this.Version) } var dw dataio.DataWriter dw.Init(w) err := dw.WriteUint32(this.Version) if err != nil { return dw.Count(), err } err = dw.WriteVarInt(uint64(len(this.Inputs))) if err != nil { return dw.Count(), err } for i, _ := range this.Inputs { err := dw.WriteWriterTo(&this.Inputs[i]) if err != nil { return dw.Count(), err } } err = dw.WriteVarInt(uint64(len(this.Outputs))) if err != nil { return dw.Count(), err } for i, _ := range this.Outputs { err := dw.WriteWriterTo(&this.Outputs[i]) if err != nil { return dw.Count(), err } } err = dw.WriteUint32(this.LockTime) if err != nil { return dw.Count(), err } return dw.Count(), nil }