Skip to content

Commit

Permalink
Fixed FallbackProvider median calculation (ethers-io#3746).
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo authored and Woodpile37 committed Jan 14, 2024
1 parent 6faf8d2 commit 98ee03a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src.ts/providers/provider-fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function getMedian(quorum: number, results: Array<TallyResult>): undefined | big
// Get the sorted values
values.sort((a, b) => ((a < b) ? -1: (b > a) ? 1: 0));

const mid = values.length / 2;
const mid = Math.floor(values.length / 2);

// Odd-length; take the middle value
if (values.length % 2) { return values[mid]; }
Expand Down

0 comments on commit 98ee03a

Please sign in to comment.