Skip to content

Commit 004849c

Browse files
numBlocksUntilSynced could be 0 and hitting infinity (#1451)
1 parent b897902 commit 004849c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/windows/SyncInfo.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ export default function SyncInfo({}: ISyncInfoProps) {
9090

9191
const currentProgress = (nodeInfo?.blockHeight ?? 0) - (initialKnownBlockheight ?? 0);
9292
const numBlocksUntilSynced = (bestBlockheight ?? 0) - (initialKnownBlockheight ?? 0);
93-
let progress = currentProgress / numBlocksUntilSynced;
93+
94+
let progress = 1;
95+
if (numBlocksUntilSynced > 0) {
96+
progress = currentProgress / numBlocksUntilSynced;
97+
}
98+
9499
if (Number.isNaN(progress)) {
95100
progress = 1;
96101
}

0 commit comments

Comments
 (0)