Companion for #3629 (XCM v2) (#571)

* Update .gitignore and bring into line with XCM v2's SendError

* type

* Some work

* Weighed responses

* extra fields to xcm pallet

* Fixes

* Bump
This commit is contained in:
Gavin Wood
2021-08-28 15:51:49 +02:00
committed by GitHub
parent f2f4f642ec
commit 276e5bdd38
12 changed files with 320 additions and 323 deletions
+4 -4
View File
@@ -33,20 +33,20 @@ use xcm::{WrapVersion, latest::prelude::*};
/// for the `SendXcm` implementation.
pub struct ParentAsUmp<T, W>(PhantomData<(T, W)>);
impl<T: UpwardMessageSender, W: WrapVersion> SendXcm for ParentAsUmp<T, W> {
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), XcmError> {
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> Result<(), SendError> {
if dest.contains_parents_only(1) {
// An upward message for the relay chain.
let versioned_xcm = W::wrap_version(&dest, msg)
.map_err(|()| XcmError::DestinationUnsupported)?;
.map_err(|()| SendError::DestinationUnsupported)?;
let data = versioned_xcm.encode();
T::send_upward_message(data)
.map_err(|e| XcmError::SendFailed(e.into()))?;
.map_err(|e| SendError::Transport(e.into()))?;
Ok(())
} else {
// Anything else is unhandled. This includes a message this is meant for us.
Err(XcmError::CannotReachDestination(dest, msg))
Err(SendError::CannotReachDestination(dest, msg))
}
}
}