99 ORACLE_SYNC_ACCEPTED_MEDIAN_ERROR_MARGIN ,
1010
1111 LOCAL_TABLE_SEND_MULTIPLIER ,
12+ MEDIAN_TABLE_SEND_MULTIPLIER ,
1213 REQUEST_AGREEMENT_TABLE_MULTIPLIER ,
1314 SIGNATURES_EXCHANGE_MULTIPLIER ,
1415)
@@ -509,6 +510,9 @@ def _receive_local_table_and_maybe_send_local_table(self):
509510 # end for
510511 return
511512
513+ def get_local_table_timeout (self ):
514+ return self .cfg_send_period * LOCAL_TABLE_SEND_MULTIPLIER
515+
512516 def _send_local_table_timeout (self ):
513517 """
514518 Check if the exchange phase of the local table has finished.
@@ -517,8 +521,8 @@ def _send_local_table_timeout(self):
517521 -------
518522 bool: True if the exchange phase of the local table has finished, False otherwise
519523 """
520- timeout_reached = ( self .time () - self . first_time_local_table_sent ) > (
521- self .cfg_send_period * LOCAL_TABLE_SEND_MULTIPLIER )
524+ first_time = self .first_time_local_table_sent
525+ timeout_reached = first_time is not None and ( self .time () - first_time ) > self . get_local_table_timeout ( )
522526 early_stopping = self ._maybe_early_stop_phase (
523527 data = self .dct_local_tables ,
524528 phase = self .STATES .S2_SEND_LOCAL_TABLE ,
@@ -713,6 +717,9 @@ def _receive_median_table_and_maybe_send_median_table(self):
713717 # end for
714718 return
715719
720+ def get_median_table_timeout (self ):
721+ return self .cfg_send_period * MEDIAN_TABLE_SEND_MULTIPLIER
722+
716723 def _send_median_table_timeout (self ):
717724 """
718725 Check if the exchange phase of the median table has finished.
@@ -721,7 +728,8 @@ def _send_median_table_timeout(self):
721728 -------
722729 bool: True if the exchange phase of the median table has finished, False otherwise
723730 """
724- timeout_reached = (self .time () - self .first_time_median_table_sent ) > self .cfg_send_period
731+ first_time = self .first_time_median_table_sent
732+ timeout_reached = first_time is not None and (self .time () - first_time ) > self .get_median_table_timeout ()
725733 early_stopping = self ._maybe_early_stop_phase (
726734 data = self .dct_median_tables ,
727735 phase = self .STATES .S4_SEND_MEDIAN_TABLE ,
@@ -1020,6 +1028,9 @@ def _receive_agreement_signature_and_maybe_send_agreement_signature(self):
10201028 # endfor received messages
10211029 return
10221030
1031+ def get_agreement_signature_timeout (self ):
1032+ return self .cfg_send_period
1033+
10231034 def _send_agreement_signature_timeout (self ):
10241035 """
10251036 Check if the exchange phase of the agreed median table has finished.
@@ -1028,7 +1039,8 @@ def _send_agreement_signature_timeout(self):
10281039 -------
10291040 bool: True if the exchange phase of the agreed median table has finished, False otherwise
10301041 """
1031- timeout_reached = (self .time () - self .first_time__agreement_signature_sent ) > self .cfg_send_period
1042+ first_time = self .first_time__agreement_signature_sent
1043+ timeout_reached = first_time is not None and (self .time () - first_time ) > self .get_agreement_signature_timeout ()
10321044 early_stopping = self ._maybe_early_stop_phase (
10331045 data = self .compiled_agreed_median_table_signatures ,
10341046 phase = self .STATES .S6_SEND_AGREED_MEDIAN_TABLE ,
@@ -1086,6 +1098,9 @@ def _exchange_agreement_signatures(self):
10861098 # endfor received messages
10871099 return
10881100
1101+ def get_exchange_signatures_timeout (self ):
1102+ return self .cfg_send_period * SIGNATURES_EXCHANGE_MULTIPLIER
1103+
10891104 def _exchange_signatures_timeout (self ):
10901105 """
10911106 Check if the exchange phase of the agreement signatures has finished.
@@ -1094,8 +1109,8 @@ def _exchange_signatures_timeout(self):
10941109 -------
10951110 bool: True if the exchange phase of the agreement signatures has finished, False otherwise
10961111 """
1097- timeout_reached = ( self .time () - self . first_time__agreement_signatures_exchanged ) > (
1098- self .cfg_send_period * SIGNATURES_EXCHANGE_MULTIPLIER )
1112+ first_time = self .first_time__agreement_signatures_exchanged
1113+ timeout_reached = first_time is not None and ( self .time () - first_time ) > self . get_exchange_signatures_timeout ( )
10991114 early_stopping = self ._maybe_early_stop_phase (
11001115 data = self .compiled_agreed_median_table_signatures ,
11011116 phase = self .STATES .S10_EXCHANGE_AGREEMENT_SIGNATURES ,
0 commit comments