Skip to content

Commit

Permalink
Merge pull request #2041 from subspace/gemini-3f-backport-fix-for-sol…
Browse files Browse the repository at this point in the history
…ution-sorting

Gemini 3f backport: Fix for solution sorting by quality
  • Loading branch information
nazar-pc authored Oct 3, 2023
2 parents 346bcab + 6019d99 commit 28d4693
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
8 changes: 2 additions & 6 deletions crates/subspace-farmer-components/src/auditing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ where
return None;
}

winning_audit_chunks.sort_by(|a, b| {
// Comparing `b` to `a` because we want smaller values first
b.solution_distance.cmp(&a.solution_distance)
});
winning_audit_chunks.sort_by(|a, b| a.solution_distance.cmp(&b.solution_distance));

Some(ChunkCandidate {
chunk_offset: chunk_offset as u32,
Expand All @@ -135,8 +132,7 @@ where
.expect("Lists of audit chunks are non-empty; qed")
.solution_distance;

// Comparing `b` to `a` because we want smaller values first
b_solution_distance.cmp(&a_solution_distance)
a_solution_distance.cmp(&b_solution_distance)
});

let best_solution_distance = winning_chunks
Expand Down
3 changes: 1 addition & 2 deletions crates/subspace-farmer/src/single_disk_farm/farming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ where
let b_solution_distance =
b.1.best_solution_distance().unwrap_or(SolutionRange::MAX);

// Comparing `b` to `a` because we want smaller values first
b_solution_distance.cmp(&a_solution_distance)
a_solution_distance.cmp(&b_solution_distance)
});

let mut solutions = Vec::<Solution<PublicKey, PublicKey>>::new();
Expand Down

0 comments on commit 28d4693

Please sign in to comment.