Skip to content

Commit

Permalink
add timeout_packet_on_channel_close_on_a in context
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed May 7, 2024
1 parent 1713241 commit b3a1f0a
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions ibc-testkit/src/relayer/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,55 @@ where
signer,
)
}

/// Timeouts a packet from the second context to the first context,
/// because of the channel is closed.
pub fn timeout_packet_on_channel_close_on_a(&mut self, packet: Packet, signer: Signer) {
let conn_id_on_a = self
.ctx_a
.ibc_store()
.channel_end(&ChannelEndPath::new(
&packet.port_id_on_a,
&packet.chan_id_on_a,
))
.expect("connection exists")
.connection_hops()[0]
.clone();

let conn_id_on_b = self
.ctx_b
.ibc_store()
.channel_end(&ChannelEndPath::new(
&packet.port_id_on_b,
&packet.chan_id_on_b,
))
.expect("connection exists")
.connection_hops()[0]
.clone();

let client_id_on_a = self
.ctx_a
.ibc_store()
.connection_end(&conn_id_on_a)
.expect("connection exists")
.client_id()
.clone();

let client_id_on_b = self
.ctx_b
.ibc_store()
.connection_end(&conn_id_on_b)
.expect("connection exists")
.client_id()
.clone();

TypedRelayerOps::<A, B>::timeout_packet_on_channel_close_on_a(
&mut self.ctx_a,
&mut self.ctx_b,
packet,
client_id_on_a,
client_id_on_b,
signer,
)
}
}

0 comments on commit b3a1f0a

Please sign in to comment.