[bug] fix broken validation_tokens deduplication

This commit is contained in:
Sosthene 2025-09-02 13:20:41 +02:00
parent afd64e2172
commit a169c99366

View File

@ -306,8 +306,13 @@ fn process_validation(
.validation_tokens
.extend(commit_msg.validation_tokens.iter());
state_to_update.validation_tokens.sort_unstable();
state_to_update.validation_tokens.dedup();
// Sort by public key to group validations by signer
state_to_update.validation_tokens.sort_unstable_by_key(|proof| proof.get_key());
// Remove duplicates where same key validates same message
state_to_update.validation_tokens.dedup_by(|a, b| {
a.get_key() == b.get_key() && a.get_message() == b.get_message()
});
}
let state_to_validate = updated_process.get_state_for_id(&new_state_id)?;