mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 01:33:20 +02:00
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:
@@ -360,12 +360,12 @@ public:
|
|||||||
|
|
||||||
friend bool operator==(const CTransaction& a, const CTransaction& b)
|
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)
|
friend bool operator!=(const CTransaction& a, const CTransaction& b)
|
||||||
{
|
{
|
||||||
return a.hash != b.hash;
|
return !operator==(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToString() const;
|
std::string ToString() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user