parity-zcash
parity-zcash copied to clipboard
Refactor node ordering logic
The logic here could be simplified using a tuple comparison. Also it's not required to duplicate logic between the PartialOrd
and Ord
impls, Ord
is a marker trait. https://github.com/ZcashFoundation/zebra/blob/master/zebra-p2p/src/util/node_table.rs#L54-L92
note also: because the NodeTable
maintains BTreeSet
s for by_score
, by_time
, but the custom-ordering-tuple-newtypes don't hold borrows, all of the node data is held in triplicate
aha, we may not be able just to simplify the comparison functions, because the code that maintains the data in triplicate stops working if we relax requirements on the sort-by-x functions (e.g., so that two nodes with equal time are equal when sorted by time).