state-res: fix tiebreaking comparisons
`node` needs to be swapped with `parent` here, otherwise the `power_level` and `age` in a `TieBreaker` inserted on the following line are always equal, because both sides are the values for `node` rather than a different value of `parent` on each iteration, and so the only thing that could possibly be different is the `event_id` because that's correctly set to `parent`. This is why I was observing tiebreaks always being sorted by `event_id` and experiencing incorrectly resolved states.
This commit is contained in:
parent
8ce5d8eb87
commit
35e459d86e
@ -340,7 +340,7 @@ where
|
||||
// Only push on the heap once older events have been cleared
|
||||
out.remove(node.borrow());
|
||||
if out.is_empty() {
|
||||
let (power_level, age) = key_fn(node.clone()).await?;
|
||||
let (power_level, age) = key_fn(parent.clone()).await?;
|
||||
heap.push(Reverse(TieBreaker {
|
||||
inv_power_level: -power_level,
|
||||
age,
|
||||
|
Loading…
x
Reference in New Issue
Block a user