@@ -16,7 +16,9 @@ use lightning_interfaces::types::{Epoch, EpochInfo, UpdateMethod};
1616use lightning_interfaces:: {
1717 ApplicationInterface ,
1818 BroadcastInterface ,
19+ EpochNotifierEmitter ,
1920 IndexSocket ,
21+ NotifierInterface ,
2022 PubSub ,
2123 SyncQueryRunnerInterface ,
2224} ;
@@ -52,6 +54,7 @@ pub struct Consensus<C: Collection> {
5254 EpochState <
5355 c ! [ C :: ApplicationInterface :: SyncExecutor ] ,
5456 c ! [ C :: BroadcastInterface :: PubSub <PubSubMsg >] ,
57+ c ! [ C :: NotifierInterface :: EpochEmitter ] ,
5558 > ,
5659 > ,
5760 > ,
@@ -71,7 +74,11 @@ pub struct Consensus<C: Collection> {
7174}
7275
7376/// This struct contains mutable state only for the current epoch.
74- struct EpochState < Q : SyncQueryRunnerInterface , P : PubSub < PubSubMsg > + ' static > {
77+ struct EpochState <
78+ Q : SyncQueryRunnerInterface ,
79+ P : PubSub < PubSubMsg > + ' static ,
80+ EN : EpochNotifierEmitter ,
81+ > {
7582 /// The node public key of the node.
7683 node_public_key : NodePublicKey ,
7784 /// The consensus public key of the node.
@@ -85,7 +92,7 @@ struct EpochState<Q: SyncQueryRunnerInterface, P: PubSub<PubSubMsg> + 'static> {
8592 /// Path to the database used by the narwhal implementation
8693 pub store_path : ResolvedPathBuf ,
8794 /// Narwhal execution state.
88- execution_state : Arc < Execution < Q > > ,
95+ execution_state : Arc < Execution < Q , EN > > ,
8996 /// Used to send transactions to consensus
9097 /// We still use this socket on consensus struct because a node is not always on the committee,
9198 /// so its not always sending a transaction to its own mempool. The signer interface
@@ -100,14 +107,16 @@ struct EpochState<Q: SyncQueryRunnerInterface, P: PubSub<PubSubMsg> + 'static> {
100107}
101108
102109#[ allow( clippy:: too_many_arguments) ]
103- impl < Q : SyncQueryRunnerInterface , P : PubSub < PubSubMsg > + ' static > EpochState < Q , P > {
110+ impl < Q : SyncQueryRunnerInterface , P : PubSub < PubSubMsg > + ' static , EN : EpochNotifierEmitter >
111+ EpochState < Q , P , EN >
112+ {
104113 fn new (
105114 node_public_key : NodePublicKey ,
106115 consensus_public_key : ConsensusPublicKey ,
107116 query_runner : Q ,
108117 narwhal_args : NarwhalArgs ,
109118 store_path : ResolvedPathBuf ,
110- execution_state : Arc < Execution < Q > > ,
119+ execution_state : Arc < Execution < Q , EN > > ,
111120 txn_socket : SubmitTxSocket ,
112121 pub_sub : P ,
113122 rx_narwhal_batches : mpsc:: Receiver < ( AuthenticStampedParcel , bool ) > ,
@@ -384,6 +393,7 @@ impl<C: Collection> ConsensusInterface<C> for Consensus<C> {
384393 query_runner : c ! ( C :: ApplicationInterface :: SyncExecutor ) ,
385394 pubsub : c ! ( C :: BroadcastInterface :: PubSub <Self :: Certificate >) ,
386395 indexer_socket : Option < IndexSocket > ,
396+ notifier : & c ! ( C :: NotifierInterface ) ,
387397 ) -> anyhow:: Result < Self > {
388398 // Spawn the registry for narwhal
389399 let registry = Registry :: new ( ) ;
@@ -413,6 +423,7 @@ impl<C: Collection> ConsensusInterface<C> for Consensus<C> {
413423 tx_narwhal_batches,
414424 query_runner. clone ( ) ,
415425 indexer_socket,
426+ notifier. epoch_emitter ( ) ,
416427 ) ) ;
417428
418429 let shutdown_notify = Arc :: new ( Notify :: new ( ) ) ;
0 commit comments