@@ -98,12 +98,6 @@ pub(crate) enum CloseChannelBy<AccountId> {
9898 Sudo ,
9999}
100100
101- /// Parameters for a new channel between two chains.
102- #[ derive( Default , Debug , Encode , Decode , Clone , Eq , PartialEq , TypeInfo , Copy ) ]
103- pub struct InitiateChannelParams {
104- pub max_outgoing_messages : u32 ,
105- }
106-
107101/// Hold identifier trait for messenger specific balance holds
108102pub trait HoldIdentifier < T : Config > {
109103 fn messenger_channel ( ) -> FungibleHoldId < T > ;
@@ -114,8 +108,8 @@ mod pallet {
114108 use crate :: weights:: WeightInfo ;
115109 use crate :: {
116110 BalanceOf , ChainAllowlistUpdate , Channel , ChannelId , ChannelState , CloseChannelBy ,
117- FeeModel , HoldIdentifier , InitiateChannelParams , Nonce , OutboxMessageResult , StateRootOf ,
118- ValidatedRelayMessage , U256 ,
111+ FeeModel , HoldIdentifier , Nonce , OutboxMessageResult , StateRootOf , ValidatedRelayMessage ,
112+ U256 ,
119113 } ;
120114 #[ cfg( not( feature = "std" ) ) ]
121115 use alloc:: boxed:: Box ;
@@ -191,6 +185,8 @@ mod pallet {
191185 type DomainRegistration : DomainRegistration ;
192186 /// Channels fee model
193187 type ChannelFeeModel : Get < FeeModel < BalanceOf < Self > > > ;
188+ /// Maximum outgoing messages from a given channel
189+ type MaxOutgoingMessages : Get < u32 > ;
194190 }
195191
196192 /// Pallet messenger used to communicate between chains and other blockchains.
@@ -559,11 +555,7 @@ mod pallet {
559555 /// Channel is set to initiated and do not accept or receive any messages.
560556 #[ pallet:: call_index( 0 ) ]
561557 #[ pallet:: weight( T :: WeightInfo :: initiate_channel( ) ) ]
562- pub fn initiate_channel (
563- origin : OriginFor < T > ,
564- dst_chain_id : ChainId ,
565- params : InitiateChannelParams ,
566- ) -> DispatchResult {
558+ pub fn initiate_channel ( origin : OriginFor < T > , dst_chain_id : ChainId ) -> DispatchResult {
567559 let owner = ensure_signed ( origin) ?;
568560
569561 // reserve channel open fees
@@ -580,7 +572,7 @@ mod pallet {
580572
581573 // initiate the channel config
582574 let channel_open_params = ChannelOpenParams {
583- max_outgoing_messages : params . max_outgoing_messages ,
575+ max_outgoing_messages : T :: MaxOutgoingMessages :: get ( ) ,
584576 fee_model : T :: ChannelFeeModel :: get ( ) ,
585577 } ;
586578 let channel_id = Self :: do_init_channel (
@@ -1014,7 +1006,7 @@ mod pallet {
10141006 Error :: <T >:: InvalidChain ,
10151007 ) ;
10161008
1017- // ensure max outgoing messages is atleast 1
1009+ // ensure max outgoing messages is at least 1
10181010 ensure ! (
10191011 init_params. max_outgoing_messages >= 1u32 ,
10201012 Error :: <T >:: InvalidMaxOutgoingMessages
0 commit comments