From dbfec4ce5f69afda02d7beba7d7052e0081c6d3e Mon Sep 17 00:00:00 2001 From: Milan Cerovsky Date: Thu, 5 Sep 2024 13:17:42 +0200 Subject: [PATCH] Fastest server estimated height valuation --- .../cash/z/ecc/android/sdk/internal/FastestServerFetcher.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/FastestServerFetcher.kt b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/FastestServerFetcher.kt index 7b05408e..449b5e54 100644 --- a/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/FastestServerFetcher.kt +++ b/sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/FastestServerFetcher.kt @@ -189,7 +189,7 @@ internal class FastestServerFetcher( return null } - if (remoteInfo.estimatedHeight >= remoteInfo.blockHeightUnsafe.value + N) { + if (remoteInfo.estimatedHeight >= remoteInfo.blockHeightUnsafe.value + SYNCED_THRESHOLD_BLOCKS) { logRuledOut("estimatedHeight does not match") return null } @@ -240,3 +240,5 @@ private val LATENCY_THRESHOLD = 300.milliseconds * Threshold for getBlockRange RPC call latency of latest [N] blocks. */ private val FETCH_THRESHOLD = 60.seconds + +private const val SYNCED_THRESHOLD_BLOCKS = 288