diff --git a/tx.go b/tx.go index a8a35487..0e254dca 100644 --- a/tx.go +++ b/tx.go @@ -90,11 +90,6 @@ func NewTxFromStream(b []byte) (*Tx, int, error) { } offset += 4 - // There is an optional Flag of 2 bytes after the version. It is always "0001" and represent that this is a SegWit tx. - if b[offset] == 0x00 && b[offset+1] == 0x01 { - offset += 2 - } - inputCount, size := DecodeVarInt(b[offset:]) offset += size diff --git a/tx_test.go b/tx_test.go index 6b91487d..a1e431f2 100644 --- a/tx_test.go +++ b/tx_test.go @@ -30,6 +30,12 @@ func TestNewTx(t *testing.T) { func TestNewTxFromString(t *testing.T) { t.Parallel() + t.Run("valid tx no inputs", func(t *testing.T) { + tx, err := bt.NewTxFromString("01000000000100000000000000001a006a07707265666978310c6578616d706c65206461746102133700000000") + assert.NoError(t, err) + assert.NotNil(t, tx) + }) + t.Run("invalid tx", func(t *testing.T) { tx, err := bt.NewTxFromString("0") assert.Error(t, err)