disputes: fix relay chain selection sanity check (#3750)

* Fix off-by-one bug in approval voting and adjust tests

* Address feedback

* Remove default disputes

* Remove spaces

* cargo +nightly fmt

Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com>
Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
authored and GitHub committed 2021-09-01 16:09:13 +00:00
1 parent 16e4c8bc28
commit b85586619f
2 files changed
+101 -78

No files matched your search

@@ -1239,6 +1239,15 @@ async fn handle_approved_ancestor(
// ancestry is moving backwards.
all_approved_max = Some((block_hash, target_number - i as BlockNumber));
}
block_descriptions.push(BlockDescription {
block_hash,
session: entry.session(),
candidates: entry
.candidates()
.iter()
.map(|(_idx, candidate_hash)| *candidate_hash)
.collect(),
});
} else if bits.len() <= ABNORMAL_DEPTH_THRESHOLD {
all_approved_max = None;
block_descriptions.clear();
@@ -1321,15 +1330,6 @@ async fn handle_approved_ancestor(
}
}
}
block_descriptions.push(BlockDescription {
block_hash,
session: entry.session(),
candidates: entry
.candidates()
.iter()
.map(|(_idx, candidate_hash)| *candidate_hash)
.collect(),
});
}
tracing::trace!(