From f5f2131a45df4089b75ff5834bf39aacbf923b27 Mon Sep 17 00:00:00 2001 From: Sudipta Basak Date: Tue, 25 Jun 2024 10:08:08 +0000 Subject: [PATCH] Divide by 0 error fix for Node with 0 validators --- DAS/observer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DAS/observer.py b/DAS/observer.py index 80b68dc..04009de 100644 --- a/DAS/observer.py +++ b/DAS/observer.py @@ -83,8 +83,8 @@ class Observer: sampleProgress = arrived / expected nodeProgress = ready / (len(validators)-1) validatorCnt = sum([v.vpn for v in validators[1:]]) - validatorAllProgress = validatedall / validatorCnt - validatorProgress = validated / validatorCnt + validatorAllProgress = (validatedall / validatorCnt) if validatorCnt != 0 else 1 + validatorProgress = (validated / validatorCnt) if validatorCnt != 0 else 1 return missingSamples, sampleProgress, nodeProgress, validatorAllProgress, validatorProgress