Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 8f1ef9d

Browse files
authored
Use correct HRMP path for parachain sibling (#366)
1 parent 00bc5cd commit 8f1ef9d

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

pallets/xcm-handler/src/lib.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,21 @@ impl<T: Config> SendXcm for Module<T> {
184184
Ok(())
185185
}
186186
// An HRMP message for a sibling parachain.
187-
Some(Junction::Parachain { id }) => {
188-
let data = msg.encode();
189-
let hash = T::Hashing::hash(&data);
190-
let message = OutboundHrmpMessage {
191-
recipient: (*id).into(),
192-
data,
193-
};
194-
T::HrmpMessageSender::send_hrmp_message(message)
195-
.map_err(|_| XcmError::CannotReachDestination)?;
196-
Self::deposit_event(RawEvent::HrmpMessageSent(hash));
197-
Ok(())
187+
Some(Junction::Parent) if dest.len() == 2 => {
188+
if let Some(Junction::Parachain { id }) = dest.at(1) {
189+
let data = msg.encode();
190+
let hash = T::Hashing::hash(&data);
191+
let message = OutboundHrmpMessage {
192+
recipient: (*id).into(),
193+
data,
194+
};
195+
T::HrmpMessageSender::send_hrmp_message(message)
196+
.map_err(|_| XcmError::CannotReachDestination)?;
197+
Self::deposit_event(RawEvent::HrmpMessageSent(hash));
198+
Ok(())
199+
} else {
200+
Err(XcmError::UnhandledXcmMessage)
201+
}
198202
}
199203
_ => {
200204
/* TODO: Handle other cases, like downward message */

0 commit comments

Comments
 (0)