refactor: CTransaction equality should consider witness data

It is not at all obvious that two transactions with differing witness data
should test equal to each other.

There was only a single instance of a caller relying on this behavior, and that
one appears accidental (left-over from before segwit). That caller (in the
wallet) has been fixed.

Change the definition of transaction equality (and inequality) to use the wtxid
instead.
This commit is contained in:
Cory Fields
2025-06-10 21:13:59 +00:00
parent cbf9b2dab1
commit 6efbd1e1dc

View File

@@ -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;