Add OnMessageAccepted callback (#1134)

* Add `OnMessageAccepted` config type

* Update actual weight

* Add unit test

* Update weight

* Remove old comment & update wrong test data

* Make ci happy

* Add lane_id param

* update test case

* Make log info more readable

* Use saturating_sub

* Update docs
This commit is contained in:
bear
2021-09-16 19:54:56 +08:00
committed by Bastian Köcher
parent 24bd2d6c51
commit 417903f9e7
6 changed files with 134 additions and 14 deletions
@@ -173,6 +173,18 @@ impl OnDeliveryConfirmed for Tuple {
}
}
/// Handler for messages have been accepted
pub trait OnMessageAccepted {
/// Called when a message has been accepted by message pallet.
fn on_messages_accepted(lane: &LaneId, message: &MessageNonce) -> Weight;
}
impl OnMessageAccepted for () {
fn on_messages_accepted(_lane: &LaneId, _message: &MessageNonce) -> Weight {
0
}
}
/// Structure that may be used in place of `TargetHeaderChain`, `LaneMessageVerifier` and
/// `MessageDeliveryAndDispatchPayment` on chains, where outbound messages are forbidden.
pub struct ForbidOutboundMessages;