Ejemplo n.º 1
0
Archivo: tx.go Proyecto: decred/dcrutil
// NewTxFromReaderLegacy returns a new instance of a transaction given a
// Reader to deserialize the transaction.  See Tx.
func NewTxFromReaderLegacy(r io.Reader) (*Tx, error) {
	// Deserialize the bytes into a MsgTx.
	var msgTx wire.MsgTx
	err := msgTx.LegacyDeserialize(r)
	if err != nil {
		return nil, err
	}

	t := Tx{
		hash:    msgTx.TxHash(),
		msgTx:   &msgTx,
		txTree:  wire.TxTreeUnknown,
		txIndex: TxIndexUnknown,
	}

	return &t, nil
}