mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 00:28:01 +00:00
Sudo utility for establishing an HRMP channel (#2067)
* Clean up of visibility of helper fns * Document HRMP channel dispatchables * Provide the sudo_establish_hrmp_channel dispatchable function * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
@@ -88,5 +88,29 @@ decl_module! {
|
||||
Error::<T>::ExceedsMaxMessageSize.into(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Forcefully establish a channel from the sender to the recipient.
|
||||
///
|
||||
/// This is equivalent to sending an `Hrmp::hrmp_init_open_channel` extrinsic followed by
|
||||
/// `Hrmp::hrmp_accept_open_channel`.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn sudo_establish_hrmp_channel(
|
||||
origin,
|
||||
sender: ParaId,
|
||||
recipient: ParaId,
|
||||
max_capacity: u32,
|
||||
max_message_size: u32,
|
||||
) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
|
||||
<hrmp::Module<T>>::init_open_channel(
|
||||
sender,
|
||||
recipient,
|
||||
max_capacity,
|
||||
max_message_size,
|
||||
)?;
|
||||
<hrmp::Module<T>>::accept_open_channel(recipient, sender)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user