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

Commit

Permalink
check for duplicate consensus state ids (#66)
Browse files Browse the repository at this point in the history
* check for duplicate consensus state ids

* clippy
  • Loading branch information
seunlanlege authored Jul 27, 2023
1 parent dca2cc6 commit c72f00a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ismp/src/handlers/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ where
// check that we have an implementation of this client
host.consensus_client(message.consensus_client_id)?;

if host.consensus_client_id(message.consensus_state_id).is_some() {
Err(Error::DuplicateConsensusStateId { consensus_state_id: message.consensus_state_id })?
}

// Store the initial state for the consensus client
host.store_consensus_state(message.consensus_state_id, message.consensus_state)?;
host.store_unbonding_period(message.consensus_state_id, message.unbonding_period)?;
Expand Down

0 comments on commit c72f00a

Please sign in to comment.