Skip to content

Commit

Permalink
numBlocksUntilSynced could be 0 and hitting infinity
Browse files Browse the repository at this point in the history
  • Loading branch information
niteshbalusu11 committed Jul 14, 2024
1 parent b897902 commit 6693c7e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/windows/SyncInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6693c7e

Please sign in to comment.