diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index bf86562886a..ad817270949 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -360,12 +360,12 @@ public: friend bool operator==(const CTransaction& a, const CTransaction& b) { - return a.hash == b.hash; + return a.GetWitnessHash() == b.GetWitnessHash(); } friend bool operator!=(const CTransaction& a, const CTransaction& b) { - return a.hash != b.hash; + return !operator==(a, b); } std::string ToString() const; diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 3a5a3fb306d..10ff535828a 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -652,7 +652,7 @@ void CTxMemPool::removeConflicts(const CTransaction &tx) auto it = mapNextTx.find(txin.prevout); if (it != mapNextTx.end()) { const CTransaction &txConflict = *it->second; - if (txConflict != tx) + if (Assume(txConflict.GetHash() != tx.GetHash())) { ClearPrioritisation(txConflict.GetHash()); removeRecursive(txConflict, MemPoolRemovalReason::CONFLICT); diff --git a/src/wallet/transaction.cpp b/src/wallet/transaction.cpp index 561880482f8..a611a034d9e 100644 --- a/src/wallet/transaction.cpp +++ b/src/wallet/transaction.cpp @@ -13,8 +13,14 @@ bool CWalletTx::IsEquivalentTo(const CWalletTx& _tx) const { CMutableTransaction tx1 {*this->tx}; CMutableTransaction tx2 {*_tx.tx}; - for (auto& txin : tx1.vin) txin.scriptSig = CScript(); - for (auto& txin : tx2.vin) txin.scriptSig = CScript(); + for (auto& txin : tx1.vin) { + txin.scriptSig = CScript(); + txin.scriptWitness.SetNull(); + } + for (auto& txin : tx2.vin) { + txin.scriptSig = CScript(); + txin.scriptWitness.SetNull(); + } return CTransaction(tx1) == CTransaction(tx2); }