mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 23:21:02 +00:00
Deposit XCM execution success and fail events. (#338)
This commit is contained in:
@@ -103,16 +103,17 @@ impl<T: Config> DownwardMessageHandler for Module<T> {
|
|||||||
fn handle_downward_message(msg: InboundDownwardMessage) {
|
fn handle_downward_message(msg: InboundDownwardMessage) {
|
||||||
let hash = msg.using_encoded(T::Hashing::hash);
|
let hash = msg.using_encoded(T::Hashing::hash);
|
||||||
frame_support::debug::print!("Processing Downward XCM: {:?}", &hash);
|
frame_support::debug::print!("Processing Downward XCM: {:?}", &hash);
|
||||||
match VersionedXcm::decode(&mut &msg.msg[..]).map(Xcm::try_from) {
|
let event = match VersionedXcm::decode(&mut &msg.msg[..]).map(Xcm::try_from) {
|
||||||
Ok(Ok(xcm)) => {
|
Ok(Ok(xcm)) => {
|
||||||
match T::XcmExecutor::execute_xcm(Junction::Parent.into(), xcm) {
|
match T::XcmExecutor::execute_xcm(Junction::Parent.into(), xcm) {
|
||||||
Ok(..) => RawEvent::Success(hash),
|
Ok(..) => RawEvent::Success(hash),
|
||||||
Err(e) => RawEvent::Fail(hash, e),
|
Err(e) => RawEvent::Fail(hash, e),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
Ok(Err(..)) => Self::deposit_event(RawEvent::BadVersion(hash)),
|
Ok(Err(..)) => RawEvent::BadVersion(hash),
|
||||||
Err(..) => Self::deposit_event(RawEvent::BadFormat(hash)),
|
Err(..) => RawEvent::BadFormat(hash),
|
||||||
}
|
};
|
||||||
|
Self::deposit_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ impl<T: Config> HrmpMessageHandler for Module<T> {
|
|||||||
fn handle_hrmp_message(sender: ParaId, msg: InboundHrmpMessage) {
|
fn handle_hrmp_message(sender: ParaId, msg: InboundHrmpMessage) {
|
||||||
let hash = msg.using_encoded(T::Hashing::hash);
|
let hash = msg.using_encoded(T::Hashing::hash);
|
||||||
frame_support::debug::print!("Processing HRMP XCM: {:?}", &hash);
|
frame_support::debug::print!("Processing HRMP XCM: {:?}", &hash);
|
||||||
match VersionedXcm::decode(&mut &msg.data[..]).map(Xcm::try_from) {
|
let event = match VersionedXcm::decode(&mut &msg.data[..]).map(Xcm::try_from) {
|
||||||
Ok(Ok(xcm)) => {
|
Ok(Ok(xcm)) => {
|
||||||
let location = (
|
let location = (
|
||||||
Junction::Parent,
|
Junction::Parent,
|
||||||
@@ -129,11 +130,12 @@ impl<T: Config> HrmpMessageHandler for Module<T> {
|
|||||||
match T::XcmExecutor::execute_xcm(location.into(), xcm) {
|
match T::XcmExecutor::execute_xcm(location.into(), xcm) {
|
||||||
Ok(..) => RawEvent::Success(hash),
|
Ok(..) => RawEvent::Success(hash),
|
||||||
Err(e) => RawEvent::Fail(hash, e),
|
Err(e) => RawEvent::Fail(hash, e),
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
Ok(Err(..)) => Self::deposit_event(RawEvent::BadVersion(hash)),
|
Ok(Err(..)) => RawEvent::BadVersion(hash),
|
||||||
Err(..) => Self::deposit_event(RawEvent::BadFormat(hash)),
|
Err(..) => RawEvent::BadFormat(hash),
|
||||||
}
|
};
|
||||||
|
Self::deposit_event(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user