Skip to content

Commit

Permalink
fix address caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed May 6, 2024
1 parent 7fd2918 commit 8bfebad
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions modules/sov-ibc-transfer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,18 @@ impl<'ws, S: Spec> IbcTransferContext<'ws, S> {
fn obtain_escrow_address(&self, port_id: &PortId, channel_id: &ChannelId) -> S::Address {
let mut working_set = self.working_set.borrow_mut();

let escrow_account = self
.ibc_transfer
self.ibc_transfer
.escrow_address_cache
.get(&(port_id.clone(), channel_id.clone()), *working_set)
.unwrap_or_else(|| compute_escrow_address::<S>(port_id, channel_id));

self.ibc_transfer.escrow_address_cache.set(
&(port_id.clone(), channel_id.clone()),
&escrow_account,
*working_set,
);
escrow_account
.unwrap_or_else(|| {
let escrow_account = compute_escrow_address::<S>(port_id, channel_id);
self.ibc_transfer.escrow_address_cache.set(
&(port_id.clone(), channel_id.clone()),
&escrow_account,
*working_set,
);
escrow_account
})
}

/// Validates that the sender has sufficient balance to perform the
Expand Down

0 comments on commit 8bfebad

Please sign in to comment.