Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
avoid cycles when creating fake candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
rphmeier committed Aug 14, 2023
1 parent abdc382 commit afc3b13
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion node/malus/src/variants/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,20 @@ where
pub fn create_fake_candidate_commitments(
persisted_validation_data: &PersistedValidationData,
) -> CandidateCommitments {
// Backing rejects candidates which output the same head as the parent,
// therefore we must create a new head which is not equal to the parent.
let mut head_data = persisted_validation_data.parent_head.clone();
if head_data.0.is_empty() {
head_data.0.push(0);
} else {
head_data.0[0] = head_data.0[0].wrapping_add(1);
};

CandidateCommitments {
upward_messages: Default::default(),
horizontal_messages: Default::default(),
new_validation_code: None,
head_data: persisted_validation_data.parent_head.clone(),
head_data,
processed_downward_messages: 0,
hrmp_watermark: persisted_validation_data.relay_parent_number,
}
Expand Down

0 comments on commit afc3b13

Please sign in to comment.