浏览代码

Fix nans in calculating balance quality

Aleksandr Borzunov 2 年之前
父节点
当前提交
ae4657ddec
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/server/block_selection.py

+ 3 - 0
src/server/block_selection.py

@@ -106,6 +106,9 @@ def should_choose_other_blocks(
             throughputs[span.start : span.end] += span.throughput
 
     new_throughput = throughputs.min()
+    if new_throughput < initial_throughput or new_throughput < eps:
+        return False
+
     actual_quality = initial_throughput / new_throughput
     logger.info(f"Swarm balance quality: {actual_quality * 100:.1f}%")