Skip to content

Commit 4326515

Browse files
committed
Merge #19822: chain: Fix CChain comparison UB by removing it (it was unused)
df53688 chain: Remove UB CChain comparison (Carl Dong) Pull request description: Comparing two empty `CChain`s is currently undefined behaviour, and resulted in false assertion failures when comparing identical empty `CChain`s in local testing. Let's just remove this comparison operator since it doesn't seem to be used anywhere. ACKs for top commit: practicalswift: ACK df53688 -- patch is guaranteed to be correct :) MarcoFalke: cr ACK df53688 Tree-SHA512: db10bac364fc965b56abf7a5bac48018786b14806ffe107e3e8eb24d5004a29331f3387dfe3409a3452a6750d3329e3f354265d787ebb3abfccabe77b28a54d5
2 parents 862fde8 + df53688 commit 4326515

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/chain.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,6 @@ class CChain {
398398
return vChain[nHeight];
399399
}
400400

401-
/** Compare two chains efficiently. */
402-
friend bool operator==(const CChain &a, const CChain &b) {
403-
return a.vChain.size() == b.vChain.size() &&
404-
a.vChain[a.vChain.size() - 1] == b.vChain[b.vChain.size() - 1];
405-
}
406-
407401
/** Efficiently check whether a block is present in this chain. */
408402
bool Contains(const CBlockIndex *pindex) const {
409403
return (*this)[pindex->nHeight] == pindex;

0 commit comments

Comments
 (0)