Skip to content

Commit

Permalink
fix: resolved PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alenmestrov committed Dec 20, 2024
1 parent 14db1bb commit bc99546
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions contracts/icp/context-config/src/mutate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ fn add_members(
let mut ctx_members = guard_ref.get_mut();

for member in members {
if !ctx_members.contains(&member) {
ctx_members.insert(member);
if ctx_members.insert(member) { // returns true if the value was newly inserted
let _ignored = context.member_nonces.entry(member).or_default();
}
}
Expand Down Expand Up @@ -376,6 +375,8 @@ fn check_and_increment_nonce(
return Err("invalid nonce".into());
}

context.member_nonces.insert(context_identity, nonce + 1);
if let Some(stored_nonce) = context.member_nonces.get_mut(&context_identity) {
*stored_nonce += 1;
}
Ok(())
}

0 comments on commit bc99546

Please sign in to comment.