tx_pool: remove redundant hashCompare comparator
What changed, and why it matters
This commit removes a custom hash comparison helper that was used to sort transaction hashes in the memory pool data structure. The code now relies on Boost's default comparison for the hash type. There is no visible security change: the removed comparator behaved the same as the standard less-than comparison for the hash data, and no behavior or interface changes are apparent.
No security action required. Treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch deletes the hashCompare functor from src/cryptonote_core/tx_pool.h and changes the sorted_tx_container bimap’s right collection from boost::bimaps::set_of<crypto::hash, hashCompare> to boost::bimaps::set_of<crypto::hash>. The custom comparator simply performed a memcmp of the hash bytes and returned < 0, which is equivalent to operator< on crypto::hash (a fixed-size byte array). The change is a code-cleanup/refactoring with no functional or security impact evident from the diff.
Changed components
src/cryptonote_core/tx_pool.hInspect captured patch +1 / −10
diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h
index 2cba87d..e78b0ef 100644
--- a/src/cryptonote_core/tx_pool.h
+++ b/src/cryptonote_core/tx_pool.h
@@ -78,18 +78,9 @@ namespace cryptonote
}
};
- class hashCompare
- {
- public:
- bool operator()(const crypto::hash& a, const crypto::hash& b) const
- {
- return memcmp(a.data, b.data, sizeof(crypto::hash)) < 0;
- }
- };
-
//! container for sorting transactions by fee per unit size
typedef boost::bimap<boost::bimaps::multiset_of<std::pair<double, std::time_t>, txFeeCompare>,
- boost::bimaps::set_of<crypto::hash, hashCompare>> sorted_tx_container;
+ boost::bimaps::set_of<crypto::hash>> sorted_tx_container;
/**
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.