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:
Bernhard Schuster
2021-09-01 18:09:13 +02:00
committed by GitHub
parent 16e4c8bc28
commit b85586619f
2 changed files with 101 additions and 78 deletions
@@ -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!(