Преглед изворни кода

validator/pow: added fixed_difficulty greater than zero shield

aggstam пре 2 година
родитељ
комит
7834a3f800
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/validator/pow.rs

+ 5 - 0
src/validator/pow.rs

@@ -112,6 +112,11 @@ impl PoWModule {
             cummulative_difficulty = difficulty.cummulative_difficulty;
         }
 
+        // If a fixed difficulty has been set, assert its greater than zero
+        if let Some(diff) = &fixed_difficulty {
+            assert!(diff > &BigUint::zero());
+        }
+
         Ok(Self {
             threads,
             target,