btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
479 stars 409 forks source link

Can't deserialize partial transaction #128

Closed RHavar closed 5 years ago

RHavar commented 5 years ago

A simple test case:

tx := wire.MsgTx{}
err = tx.Deserialize(hexToBytes("02000000000100e1f5050000000017a914ba4bdb0b07d67bc60f59c1f4fe541705652549748700000000"))

err == "unexpected EOF"

while I can decode it with core:

$ bitcoin-cli decoderawtransaction 02000000000100e1f5050000000017a914ba4bdb0b07d67bc60f59c1f4fe541705652549748700000000
{
  "txid": "06fe61025e1e7911445cdc6128fa4447e85131c46bc49a97ea637c6ae024fa17",
  "hash": "06fe61025e1e7911445cdc6128fa4447e85131c46bc49a97ea637c6ae024fa17",
  "version": 2,
  "size": 42,
  "vsize": 42,
  "weight": 168,
  "locktime": 0,
  "vin": [
  ],
  "vout": [
    {
      "value": 1.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 ba4bdb0b07d67bc60f59c1f4fe54170565254974 OP_EQUAL",
        "hex": "a914ba4bdb0b07d67bc60f59c1f4fe5417056525497487",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2NAEGYWL2VhiXjvXjhe3QoGY8vo8zLumEAt"
        ]
      }
    }
  ]
}

(note how the transaction has no inputs).

This seems to be causing issues as i'm trying to an rpc call to createrawtransaction (without inputs) and then push it through fundrawtransaction. But it seems to have trouble parsing the result of createrawtransaction :(

RHavar commented 5 years ago

Sorry, wrong library.