From 83957dc283043b9af8f6e89920faac3e09ca69fc Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Tue, 14 Feb 2023 11:54:08 -0500 Subject: [PATCH] Fixed FallbackProvider median calculation (#3746). --- src.ts/providers/provider-fallback.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src.ts/providers/provider-fallback.ts b/src.ts/providers/provider-fallback.ts index b93999da8f..6be29c95da 100644 --- a/src.ts/providers/provider-fallback.ts +++ b/src.ts/providers/provider-fallback.ts @@ -250,7 +250,7 @@ function getMedian(quorum: number, results: Array): 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]; }