Example #1
0
File: tx.go Project: 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
}