diff options
author | fanquake <fanquake@gmail.com> | 2020-08-28 19:21:02 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-08-28 19:44:47 +0800 |
commit | 4326515f01d7938bb448e7a9338dcc9c98497847 (patch) | |
tree | 2da64ff552c6428a8c91a668bc1123af259211d0 | |
parent | 862fde88be706adb20a211178253636442c3ae00 (diff) | |
parent | df536883d263781c2abe944afc85f681cda635ed (diff) |
Merge #19822: chain: Fix CChain comparison UB by removing it (it was unused)
df536883d263781c2abe944afc85f681cda635ed 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 df536883d263781c2abe944afc85f681cda635ed -- patch is guaranteed to be correct :)
MarcoFalke:
cr ACK df536883d263781c2abe944afc85f681cda635ed
Tree-SHA512: db10bac364fc965b56abf7a5bac48018786b14806ffe107e3e8eb24d5004a29331f3387dfe3409a3452a6750d3329e3f354265d787ebb3abfccabe77b28a54d5
-rw-r--r-- | src/chain.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/chain.h b/src/chain.h index 802e23f775..43e8a39f36 100644 --- a/src/chain.h +++ b/src/chain.h @@ -398,12 +398,6 @@ public: return vChain[nHeight]; } - /** Compare two chains efficiently. */ - friend bool operator==(const CChain &a, const CChain &b) { - return a.vChain.size() == b.vChain.size() && - a.vChain[a.vChain.size() - 1] == b.vChain[b.vChain.size() - 1]; - } - /** Efficiently check whether a block is present in this chain. */ bool Contains(const CBlockIndex *pindex) const { return (*this)[pindex->nHeight] == pindex; |