示例#1
0
文件: tx.go 项目: 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
}