Log distinct error cases in Equihash verification

This commit is contained in:
Jack Grigg
2019-08-18 23:56:15 +01:00
parent 9016548698
commit 7c1d4d9a5b
3 changed files with 15 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ ff = { path = "../ff" }
fpe = "0.2"
hex = "0.3"
lazy_static = "1"
log = "0.4"
pairing = { path = "../pairing" }
rand = "0.7"
rand_core = "0.5"

View File

@@ -1,5 +1,6 @@
use blake2b_simd::{Hash as Blake2bHash, Params as Blake2bParams, State as Blake2bState};
use byteorder::{BigEndian, LittleEndian, ReadBytesExt, WriteBytesExt};
use log::error;
use std::io::Cursor;
use std::mem::size_of;
@@ -196,13 +197,13 @@ fn distinct_indices(a: &Node, b: &Node) -> bool {
fn validate_subtrees(p: &Params, a: &Node, b: &Node) -> bool {
if !has_collision(a, b, p.collision_byte_length()) {
// error!("Invalid solution: invalid collision length between StepRows");
error!("Invalid solution: invalid collision length between StepRows");
false
} else if b.indices_before(a) {
// error!("Invalid solution: Index tree incorrectly ordered");
error!("Invalid solution: Index tree incorrectly ordered");
false
} else if !distinct_indices(a, b) {
// error!("Invalid solution: duplicate indices");
error!("Invalid solution: duplicate indices");
false
} else {
true