Bitcoin core gives wrong previous Tx

2

1

I run my own bitcoin core node: MacOS version v0.16.3 (64-bit)

I want to analyse tx: 3170cd6c0d49c1c851d640547b5533b62e40071c376feeb83a0a40bce5195802

The first input (key 2MxcuVyGCgS3eua3GtqNnZ27u78Kb4e2HZi) is a reference to tx 671d52454812a73517aac8b8d0aeff82a81dc1a493f84fdcfa6273e930fa6288

My problem: in Bitcoin core console

getrawtransaction 671d52454812a73517aac8b8d0aeff82a81dc1a493f84fdcfa6273e930fa6288

gives

020000000001014b2f3d5c0a5b6ee52ffc9055a136259293e5c18d9e6dbee4940a89771cab0f6f00000000171600148b09361ee67671f8dcae817d9cf63e4813a6aedafeffffff02f09f32080000000017a914a232cca07c26b7563c45cb3b376f4cb6c10567ad8740420f000000000017a9143af258d1325b375a690373e70984fd4b31c52a24870248304502210081c915acf6e45b0ec3f5095a67ce08219ac530925343b1f48e860fffc22a7a11022002dedd31f12d91c79f6f8eac1a8740fc95a6f4db072337400ce32f15b3b4698f0121020a971d08e76b5ced32d9c340ea0c37d4ad0322a6e579352b38d4db8d0bda73b928e31500

decoderawtransaction(020000...31500)

gives

{
"txid": "0c47b3981a84eed8032fe87f7909da1c95fb35adcb8ba533c24712589487ca49",   
"hash": "0c47b3981a84eed8032fe87f7909da1c95fb35adcb8ba533c24712589487ca49", 
...
}

which is the wrong tx. I checked on few explorers and they give the right tx.

What's wrong with my bitcoin core ?

jfjobidon

Posted 2018-10-11T18:49:34.043

Reputation: 265

bitcoin core version?JBaczuk 2018-10-11T18:52:47.827

MacOS version v0.16.3 (64-bit) TESTNETjfjobidon 2018-10-11T19:05:11.557

Answers

2

671d52454812a73517aac8b8d0aeff82a81dc1a493f84fdcfa6273e930fa6288 is the txid while 0c47b3981a84eed8032fe87f7909da1c95fb35adcb8ba533c24712589487ca49 is the wtxid. wtxid was introduced with segwit. For more info check BIP141

Mike D

Posted 2018-10-11T18:49:34.043

Reputation: 1 571

OK, but still: how do I get the right Tx ? after the decoderawtransaction, I only have one entry in vout, but Tx 671d524548... has two and I need vout[1] which doesn't exist !jfjobidon 2018-10-12T23:41:09.830

@jfjobidon for some reason decoderawtransaction fails to understand it is a segwit tx. If you add the optional iswitness parameter to true it should be parsed normally. try decoderawtransaction <hex> trueMike D 2018-10-13T18:11:53.880

Thanks: with the isWitness = true, I get the right result. From https://bitcointalk.org/index.php?topic=5014781.0 I understand there is a bug and I should add my own test to detect if the tx is segwit.

jfjobidon 2018-10-15T17:29:34.047

Curiously: getrawtransaction 671d...930fa6288 1 gives the right transactionjfjobidon 2018-10-15T17:31:29.857