Skip to content

Commit

Permalink
Fix issue with the error variant of new_check_header_and_update met…
Browse files Browse the repository at this point in the history
…hod (#406)

* Return None if ConsensusState not found in new_check_header_and_update_state

* Add changelog entry
  • Loading branch information
Farhad-Shabani authored Feb 9, 2023
1 parent d11e059 commit 6f482c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Fix issue with the error handling in the `new_check_header_and_update_state`
method when consensus state is not found
([#405](https://github.com/cosmos/ibc-rs/issues/405))
8 changes: 7 additions & 1 deletion crates/ibc/src/clients/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,14 @@ impl Ics2ClientState for ClientState {
match ctx.consensus_state(client_id, &height) {
Ok(cs) => Ok(Some(cs)),
Err(e) => match e {
ContextError::ClientError(ClientError::ConsensusStateNotFound {
client_id: _,
height: _,
}) => Ok(None),
ContextError::ClientError(e) => Err(e),
_ => Ok(None),
_ => Err(ClientError::Other {
description: e.to_string(),
}),
},
}
}
Expand Down

0 comments on commit 6f482c1

Please sign in to comment.