From 6693c7e03dc3a272948d744c8238f5407b7fabb3 Mon Sep 17 00:00:00 2001 From: Nitesh Balusu Date: Sun, 14 Jul 2024 12:05:19 -0400 Subject: [PATCH] numBlocksUntilSynced could be 0 and hitting infinity --- src/windows/SyncInfo.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/windows/SyncInfo.tsx b/src/windows/SyncInfo.tsx index 9e72b40e4..d95e42bd4 100644 --- a/src/windows/SyncInfo.tsx +++ b/src/windows/SyncInfo.tsx @@ -90,7 +90,12 @@ export default function SyncInfo({}: ISyncInfoProps) { const currentProgress = (nodeInfo?.blockHeight ?? 0) - (initialKnownBlockheight ?? 0); const numBlocksUntilSynced = (bestBlockheight ?? 0) - (initialKnownBlockheight ?? 0); - let progress = currentProgress / numBlocksUntilSynced; + + let progress = 1; + if (numBlocksUntilSynced > 0) { + progress = currentProgress / numBlocksUntilSynced; + } + if (Number.isNaN(progress)) { progress = 1; }