Author

Topic: RPC API decoderawtransaction - Strange behaviour with P2WPKH/P2WSH (Read 647 times)

sr. member
Activity: 384
Merit: 258
staff
Activity: 3458
Merit: 6793
Just writing some code
Well it's definitely a bug and a fix will probably be in 0.14. See https://botbot.me/freenode/bitcoin-core-dev/2017-01-12/?msg=79232562&page=1
sr. member
Activity: 384
Merit: 258
Interesting. This looks like it is a bug.
What is happening is that decoderawtransaction is not decoding the transaction as a segwit transaction but rather as a normal transaction.

Agreed

This is on testnet I presume.

Yes
staff
Activity: 3458
Merit: 6793
Just writing some code
Interesting. This looks like it is a bug.

What is happening is that decoderawtransaction is not decoding the transaction as a segwit transaction but rather as a normal transaction.

This is on testnet I presume.
sr. member
Activity: 384
Merit: 258
I'm currently doing a few tests with bitcoin core 0.13.2 and I've noticed that decoderawtransaction has a strange behavior when used on some segwit txs (e.g: a24cec50d5cf861d1af4b634f8ed1968c0e9484724bfef5af7f8c383605978c8)

Everything seems ok if I call getrawtransaction in verbose mode for this txid
Code:
> getrawtransaction "a24cec50d5cf861d1af4b634f8ed1968c0e9484724bfef5af7f8c383605978c8" 1

{
  "hex": "02000000000101c564a62f94c025ac80137817d8658aabceaaad30412facecba1bd2255182e1c40000000000ffffffff01ca124c000000000016001443aac20a116e09ea4f7914be1c55e4c17aa600b7024730440220679eaf5e41eee49b38f3112ec90b49a655db21677db4d7fa80de67aeb987161102204024b85730fc106d0b870623fc221946e624413363eb627fe90eb5047d35565c012103335134d7414e1d1a154600b124a96f5ef2c6ca21434d2622469a96bd5262fd5600000000",
  "txid": "a24cec50d5cf861d1af4b634f8ed1968c0e9484724bfef5af7f8c383605978c8",
  "hash": "54ad9b3b24064c4033814ddc712a393cfa4e011eb7ac24374687511cd056eac5",
  "size": 191,
  "vsize": 110,
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "txid": "c4e1825125d21bbaecac2f4130adaaceab8a65d817781380ac25c0942fa664c5",
      "vout": 0,
      "scriptSig": {
        "asm": "",
        "hex": ""
      },
      "txinwitness": [
        "30440220679eaf5e41eee49b38f3112ec90b49a655db21677db4d7fa80de67aeb987161102204024b85730fc106d0b870623fc221946e624413363eb627fe90eb5047d35565c01",
        "03335134d7414e1d1a154600b124a96f5ef2c6ca21434d2622469a96bd5262fd56"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.04985546,
      "n": 0,
      "scriptPubKey": {
        "asm": "0 43aac20a116e09ea4f7914be1c55e4c17aa600b7",
        "hex": "001443aac20a116e09ea4f7914be1c55e4c17aa600b7",
        "type": "witness_v0_keyhash"
      }
    }
  ],
  "blockhash": "0000000000001f21187cb667bdb30109a24bf42821f58b0cedf8c7d5641cbc33",
  "confirmations": 172230,
  "time": 1467400024,
  "blocktime": 1467400024
}

Now, here is what I get if I call decoderawtransaction with the hex of this tx

Code:
> decoderawtransaction "02000000000101c564a62f94c025ac80137817d8658aabceaaad30412facecba1bd2255182e1c40000000000ffffffff01ca124c000000000016001443aac20a116e09ea4f7914be1c55e4c17aa600b7024730440220679eaf5e41eee49b38f3112ec90b49a655db21677db4d7fa80de67aeb987161102204024b85730fc106d0b870623fc221946e624413363eb627fe90eb5047d35565c012103335134d7414e1d1a154600b124a96f5ef2c6ca21434d2622469a96bd5262fd5600000000"

{
  "txid": "54ad9b3b24064c4033814ddc712a393cfa4e011eb7ac24374687511cd056eac5",
  "hash": "54ad9b3b24064c4033814ddc712a393cfa4e011eb7ac24374687511cd056eac5",
  "size": 191,
  "vsize": 191,
  "version": 2,
  "locktime": 0,
  "vin": [
  ],
  "vout": [
    {
      "value": 27203371073.07775233,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_LEFT 7817d8658aabceaaad30412facecba1bd22551 OP_SIZE OP_UNKNOWN OP_UNKNOWN 0 0 0 0 0 OP_INVALIDOPCODE OP_INVALIDOPCODE OP_INVALIDOPCODE OP_INVALIDOPCODE -74 4c000000000016001443aac20a116e09ea4f OP_PICK be1c55e4c17aa600b7024730440220679eaf5e41 OP_UNKNOWN OP_UNKNOWN OP_BOOLOR f3112ec90b49a655db21677db4d7fa80de67aeb987161102204024b85730fc106d0b870623fc221946e624413363eb627fe90eb5047d3556 12 33 3428659 OP_UNKNOWN [error]",
        "hex": "80137817d8658aabceaaad30412facecba1bd2255182e1c40000000000ffffffff01ca124c000000000016001443aac20a116e09ea4f7914be1c55e4c17aa600b7024730440220679eaf5e41eee49b38f3112ec90b49a655db21677db4d7fa80de67aeb987161102204024b85730fc106d0b870623fc221946e624413363eb627fe90eb5047d35565c012103335134d7414e1d1a154600b124a96f5ef2c6ca21434d2622469a96bd5262fd56",
        "type": "nonstandard"
      }
    }
  ]
}

From my observations, everything seems ok for txs with P2WPKH or P2WSH nested in P2SH.
Do I miss something ? Is it a known issue (or temporary limitation or decoderawtransaction) ?

Thanks in advance !
Jump to: