diff --git a/src/commit.rs b/src/commit.rs index 6d28ece..29cfc01 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -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)?;