@@ -32,6 +32,7 @@ use rlp::{Encodable, UntrustedRlp};
3232use super :: backup:: { backup, restore, BackupView } ;
3333use super :: message:: * ;
3434use super :: network;
35+ use super :: params:: TimegapParams ;
3536use super :: types:: { BitSet , Height , Proposal , Step , TendermintSealView , TendermintState , TwoThirdsMajority , View } ;
3637use super :: {
3738 BlockHash , ENGINE_TIMEOUT_BROADCAST_STEP_STATE , ENGINE_TIMEOUT_EMPTY_PROPOSAL , ENGINE_TIMEOUT_TOKEN_NONCE_BASE ,
@@ -57,8 +58,8 @@ type SpawnResult = (
5758 crossbeam:: Sender < ( ) > ,
5859) ;
5960
60- pub fn spawn ( validators : Arc < ValidatorSet > ) -> SpawnResult {
61- Worker :: spawn ( validators)
61+ pub fn spawn ( validators : Arc < ValidatorSet > , allowed_time_gaps : TimegapParams ) -> SpawnResult {
62+ Worker :: spawn ( validators, allowed_time_gaps )
6263}
6364
6465struct Worker {
@@ -87,7 +88,7 @@ struct Worker {
8788 validators : Arc < ValidatorSet > ,
8889 /// Channel to the network extension, must be set later.
8990 extension : EventSender < network:: Event > ,
90-
91+ allowed_time_gaps : TimegapParams ,
9192 timeout_token_nonce : usize ,
9293}
9394
@@ -167,7 +168,12 @@ pub enum Event {
167168impl Worker {
168169 #![ cfg_attr( feature = "cargo-clippy" , allow( clippy:: new_ret_no_self) ) ]
169170 /// Create a new instance of Tendermint engine
170- fn new ( validators : Arc < ValidatorSet > , extension : EventSender < network:: Event > , client : Weak < EngineClient > ) -> Self {
171+ fn new (
172+ validators : Arc < ValidatorSet > ,
173+ extension : EventSender < network:: Event > ,
174+ client : Weak < EngineClient > ,
175+ allowed_time_gaps : TimegapParams ,
176+ ) -> Self {
171177 Worker {
172178 client,
173179 height : 1 ,
@@ -182,12 +188,12 @@ impl Worker {
182188 extension,
183189 votes_received : BitSet :: new ( ) ,
184190 votes_received_changed : false ,
185-
191+ allowed_time_gaps ,
186192 timeout_token_nonce : ENGINE_TIMEOUT_TOKEN_NONCE_BASE ,
187193 }
188194 }
189195
190- fn spawn ( validators : Arc < ValidatorSet > ) -> SpawnResult {
196+ fn spawn ( validators : Arc < ValidatorSet > , allowed_timegaps : TimegapParams ) -> SpawnResult {
191197 let ( sender, receiver) = crossbeam:: unbounded ( ) ;
192198 let ( quit, quit_receiver) = crossbeam:: bounded ( 1 ) ;
193199 let ( extension_initializer, extension_receiver) = crossbeam:: bounded ( 1 ) ;
@@ -215,7 +221,7 @@ impl Worker {
215221 }
216222 } ;
217223 validators. register_client ( Weak :: clone ( & client) ) ;
218- let mut inner = Self :: new ( validators, extension, client) ;
224+ let mut inner = Self :: new ( validators, extension, client, allowed_timegaps ) ;
219225 loop {
220226 crossbeam:: select! {
221227 recv( receiver) -> msg => {
0 commit comments