Exemplo n.º 1
0
func (this *TxIn) WriteTo(w io.Writer) (int64, error) {
	var dw dataio.DataWriter
	dw.Init(w)

	err := dw.Write(this.Previous.Hash[:])
	if err != nil {
		return dw.Count(), err
	}

	err = dw.WriteUint32(this.Previous.Index)
	if err != nil {
		return dw.Count(), err
	}

	err = dw.WriteVarBytes(this.Script)
	if err != nil {
		return dw.Count(), err
	}

	err = dw.WriteUint32(this.Sequence)
	if err != nil {
		return dw.Count(), err
	}

	return dw.Count(), nil
}
Exemplo n.º 2
0
func (this *TxOut) WriteTo(w io.Writer) (int64, error) {
	var dw dataio.DataWriter
	dw.Init(w)

	err := dw.WriteInt64(this.Value)
	if err != nil {
		return dw.Count(), err
	}

	err = dw.WriteVarBytes(this.Script)
	if err != nil {
		return dw.Count(), err
	}

	return dw.Count(), nil
}