diff --git a/src/gtest/test_txid.cpp b/src/gtest/test_txid.cpp index 6ded18d2e..9b4a21068 100644 --- a/src/gtest/test_txid.cpp +++ b/src/gtest/test_txid.cpp @@ -8,15 +8,16 @@ #include "utilstrencodings.h" /* - Test that removing #1144 succeeded by verifying that the hash and txid of transactions are the same. + Test that removing #1144 succeeded by verifying the hash of a transaction is over the entire serialized form. */ TEST(txid_tests, check_txid_and_hash_are_same) { - // Random zcash transaction 0e410d5dfb44a4aa0f536605c6f6f7cc6016f39dea35ed9291ddfc402da6caaa + // Random zcash transaction aacaa62d40fcdd9192ed35ea9df31660ccf7f6c60566530faaa444fb5d0d410e CTransaction tx; CDataStream stream(ParseHex("01000000015ad78be5497476bbf84869d8156761ca850b6e82e48ad1315069a3726516a3d1010000006b483045022100ba5e90204e83c5f961b67c6232c1cc6c360afd36d43fcfae0de7af2e75f4cda7022012fec415a12048dbb70511fda6195b090b56735232281dc1144409833a092edc012102c322382e17c9ed4f47183f219cc5dd7853f939fb8eebae3c943622e0abf8d5e5feffffff0280969800000000001976a91430271a250e92135ce0db0783ebb63aaeb58e47f988acd694693a000000001976a9145f0d00adba6489150808feb4108d7be582cbb2e188ac0a000000"), SER_DISK, CLIENT_VERSION); stream >> tx; - ASSERT_EQ(tx.GetHash(), tx.GetTxid()); + uint256 hash = uint256S("aacaa62d40fcdd9192ed35ea9df31660ccf7f6c60566530faaa444fb5d0d410e"); + ASSERT_TRUE(hash == tx.GetHash()); } TEST(txid_tests, check_txid_and_hash_are_same_coinbase) { @@ -28,8 +29,6 @@ TEST(txid_tests, check_txid_and_hash_are_same_coinbase) { ASSERT_TRUE(tx.IsCoinBase()); uint256 hash = uint256S("6041357de59ba64959d1b60f93de24dfe5ea1e26ed9e8a73d35b225a1845bad5"); - ASSERT_TRUE(hash==tx.GetTxid()); - - ASSERT_EQ(tx.GetHash(), tx.GetTxid()); + ASSERT_TRUE(hash == tx.GetHash()); } diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 952242aca..2e83773c4 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -345,10 +345,6 @@ public: return hash; } - const uint256& GetTxid() const { - return hash; - } - // Return sum of txouts. CAmount GetValueOut() const; // GetValueIn() is a method on CCoinsViewCache, because @@ -417,10 +413,6 @@ struct CMutableTransaction * fly, as opposed to GetHash() in CTransaction, which uses a cached result. */ uint256 GetHash() const; - - uint256 GetTxid() const { - return GetHash(); - } }; #endif // BITCOIN_PRIMITIVES_TRANSACTION_H