zcash-patched-for-explorer/src/wallet
zkbot 95277e0311 Auto merge of #1144 - bitcartel:zc.v0.11.2.z7_tx_malleability_gettxid, r=bitcartel
A fix for transaction malleability

This PR fixes transaction malleability by not including the sigscript of transaction inputs and joinsplit sigs when hashing the txid.

This PR supercedes PR #1101 which was a minimal solution based on a new serialization flag.

This PR introduces GetTxid() to distinguish between getting a transaction id and the double sha256 hash.

The key changes are:
- Adding GetTxid() method to CTransaction which makes a copy of the transaction, clearing out the sigscript and joinsplitsig fields, before hashing.
- Verifying that every call to GetHash() actually wants a txid, and replacing with GetTxid().
- Renaming GetHash() to GetSerializeHash()
  - Rationale: In future, upstream code we want to merge will use GetHash() but we don't know the intent.  We should check to see if the intent is to receive a txid (most likely) in which case we replace with GetTxid(), or if upstream actually wants a double hash of the transaction we can use GetSerializeHash().
- Updated genesis data in chainparams.cpp

Note that coinbase transactions are excluded as they need the sigscript hashed to help avoid duplicate txids per BIP34:
  - This modification is related to a question from @ebfull on PR #1101 - "Can we think of a way this change allows us to construct two transactions with the same txid which can simultaneously appear in the blockchain? My guess is it would be possible to construct a coinbase transaction of such a form... this surely breaks invariants."

This PR Passes all tests in test_bitcoin (test data was updated in bloom_tests, miner_tests and script_tests).
2016-08-05 19:31:52 +00:00
..
test
crypter.cpp Make sure LogPrintf strings are line-terminated 2015-09-22 00:43:11 +00:00
crypter.h ensure consistent header comment naming conventions 2015-04-20 13:29:22 +02:00
db.cpp fix crash on shutdown when e.g. changing -txindex and abort action 2015-06-23 10:12:11 +02:00
db.h fix crash on shutdown when e.g. changing -txindex and abort action 2015-06-23 10:12:11 +02:00
rpcdump.cpp Push down RPC reqWallet flag 2015-04-12 19:37:29 +02:00
rpcwallet.cpp Auto merge of #1144 - bitcartel:zc.v0.11.2.z7_tx_malleability_gettxid, r=bitcartel 2016-08-05 19:31:52 +00:00
wallet.cpp Replace calls to GetHash() with GetTxid() for transaction objects. 2016-07-26 17:13:03 -07:00
wallet.h Bucket -> note. 2016-07-18 10:06:18 -06:00
wallet_ismine.cpp
wallet_ismine.h ensure consistent header comment naming conventions 2015-04-20 13:29:22 +02:00
walletdb.cpp Replace calls to GetHash() with GetTxid() for transaction objects. 2016-07-26 17:13:03 -07:00
walletdb.h ensure consistent header comment naming conventions 2015-04-20 13:29:22 +02:00