Do not expire HRMP open channel requests (#3543)

* Do not expire HRMP open channel requests

* Fix the build and update the docs

* Implement canceling requests and do not remove them automatically

* Fix a borked merge

* Fix fmt

* Please spellchecker

* Apply suggestions from code review

Co-authored-by: Amar Singh <asinghchrony@protonmail.com>

* Use `mutate_exists` for maintaining request counts

* Apply `rustfmt`

* Move newly introduced entrypoint to end to preserve ordering

Co-authored-by: Amar Singh <asinghchrony@protonmail.com>
This commit is contained in:
Sergei Shulepov
2021-09-09 14:06:13 +02:00
committed by GitHub
parent f66b6cccda
commit 83a35874ee
7 changed files with 250 additions and 118 deletions
+9 -1
View File
@@ -328,7 +328,8 @@ impl<T: Encode + Decode + Default> AccountIdConversion<T> for Id {
/// unidirectional, meaning that `(A, B)` and `(B, A)` refer to different channels. The convention is
/// that we use the first item tuple for the sender and the second for the recipient. Only one channel
/// is allowed between two participants in one direction, i.e. there cannot be 2 different channels
/// identified by `(A, B)`.
/// identified by `(A, B)`. A channel with the same para id in sender and recipient is invalid. That
/// is, however, not enforced.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, RuntimeDebug)]
#[cfg_attr(feature = "std", derive(Hash))]
pub struct HrmpChannelId {
@@ -338,6 +339,13 @@ pub struct HrmpChannelId {
pub recipient: Id,
}
impl HrmpChannelId {
/// Returns true if the given id corresponds to either the sender or the recipient.
pub fn is_participant(&self, id: Id) -> bool {
id == self.sender || id == self.recipient
}
}
/// A message from a parachain to its Relay Chain.
pub type UpwardMessage = Vec<u8>;