Skip to content

Commit

Permalink
fix(ucs01): don't receive twice when pfm
Browse files Browse the repository at this point in the history
Signed-off-by: aeryz <[email protected]>
  • Loading branch information
aeryz committed Jun 10, 2024
1 parent da67107 commit 2dc2fe5
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cosmwasm/ucs01-relay-api/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,6 @@ pub trait TransferProtocol {
let handle = || -> Result<IbcReceiveResponse<Self::CustomMsg>, Self::Error> {
let packet = Self::Packet::try_from(original_packet.data.clone())?;

// NOTE: The default message ack is always successful and only
// overwritten if the submessage execution revert via the reply
// handler. The caller must ensure that the protocol is called in
// the reply handler via the `receive_error` for the acknowledgement
// to be overwritten.
let transfer_msgs = self
.receive_transfer(packet.receiver(), packet.tokens())?
.1
.into_iter()
.map(|msg| SubMsg::reply_on_error(msg, Self::RECEIVE_REPLY_ID));

let memo = Into::<String>::into(packet.extension().clone());

if let Ok(memo) = serde_json_wasm::from_str::<Memo>(&memo) {
Expand All @@ -328,6 +317,17 @@ pub trait TransferProtocol {
};
}

// NOTE: The default message ack is always successful and only
// overwritten if the submessage execution revert via the reply
// handler. The caller must ensure that the protocol is called in
// the reply handler via the `receive_error` for the acknowledgement
// to be overwritten.
let transfer_msgs = self
.receive_transfer(packet.receiver(), packet.tokens())?
.1
.into_iter()
.map(|msg| SubMsg::reply_on_error(msg, Self::RECEIVE_REPLY_ID));

let packet_event = if memo.is_empty() {
Event::new(PACKET_EVENT)
} else {
Expand Down

0 comments on commit 2dc2fe5

Please sign in to comment.