@@ -8,7 +8,6 @@ use std::sync::Arc;
88use async_trait:: async_trait;
99use bfte_consensus_core:: block:: BlockRound ;
1010use bfte_consensus_core:: citem:: { CItemRaw , InputRaw , OutputRaw } ;
11- use bfte_consensus_core:: module:: config:: ModuleParamsRaw ;
1211use bfte_consensus_core:: module:: { ModuleId , ModuleKind } ;
1312use bfte_consensus_core:: peer:: PeerPubkey ;
1413use bfte_consensus_core:: peer_set:: PeerSet ;
@@ -35,8 +34,10 @@ pub struct DynModuleWithConfig {
3534pub struct ModuleInitArgs {
3635 pub db : ModuleDatabase ,
3736 pub module_consensus_version : ConsensusVersion ,
38- pub config : ModuleParamsRaw ,
3937 pub peer_pubkey : Option < PeerPubkey > ,
38+ /// Only AppConsensus module should use this
39+ #[ doc( hidden) ]
40+ pub modules_inits : BTreeMap < ModuleKind , DynModuleInit > ,
4041}
4142
4243pub type DynModuleInit = Arc < dyn IModuleInit + Send + Sync > ;
@@ -46,14 +47,14 @@ impl ModuleInitArgs {
4647 module_id : ModuleId ,
4748 db : Arc < Database > ,
4849 module_consensus_version : ConsensusVersion ,
49- config : ModuleParamsRaw ,
50+ modules_inits : BTreeMap < ModuleKind , DynModuleInit > ,
5051 peer_pubkey : Option < PeerPubkey > ,
5152 ) -> Self {
5253 Self {
5354 db : ModuleDatabase :: new ( module_id, db) ,
5455 module_consensus_version,
55- config,
5656 peer_pubkey,
57+ modules_inits,
5758 }
5859 }
5960}
@@ -78,6 +79,9 @@ pub type ModuleSupportedConsensusVersions = BTreeMap<ConsensusVersionMajor, Cons
7879pub trait IModuleInit : Any {
7980 fn kind ( & self ) -> ModuleKind ;
8081
82+ /// If true, this module kind can be installed only once in the federation
83+ fn singleton ( & self ) -> bool ;
84+
8185 fn display_name ( & self ) -> & ' static str ;
8286
8387 /// All major consensus version supported by the module, with latest
0 commit comments