Skip to content

Commit

Permalink
Make ChainEndpoint::get_key take &self instead of &mut self (#3732
Browse files Browse the repository at this point in the history
)

Updates the `get_key` method on the `ChainEndpoint` trait to take `&self` instead of `&mut self`, as it wasn't needed for self to be mutable. it's also expected that a function named as `get` doesn't mutate self. this also allows `get_key` to be used in methods that take `&self`.
  • Loading branch information
noot authored Jan 3, 2024
1 parent 5290c8c commit 86f3a5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/cosmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ impl ChainEndpoint for CosmosSdkChain {
&mut self.keybase
}

fn get_key(&mut self) -> Result<Self::SigningKeyPair, Error> {
fn get_key(&self) -> Result<Self::SigningKeyPair, Error> {
// Get the key from key seed file
let key_pair = self
.keybase()
Expand Down
2 changes: 1 addition & 1 deletion crates/relayer/src/chain/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub trait ChainEndpoint: Sized {
fn get_signer(&self) -> Result<Signer, Error>;

/// Get the signing key pair
fn get_key(&mut self) -> Result<Self::SigningKeyPair, Error>;
fn get_key(&self) -> Result<Self::SigningKeyPair, Error>;

fn add_key(&mut self, key_name: &str, key_pair: Self::SigningKeyPair) -> Result<(), Error> {
self.keybase_mut()
Expand Down

0 comments on commit 86f3a5c

Please sign in to comment.