File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,14 @@ impl BlockInfo {
258
258
self . state = state;
259
259
Ok ( ( ) )
260
260
}
261
+
262
+ /// Check if the block is globally accepted or rejected
263
+ pub fn has_reached_consensus ( & self ) -> bool {
264
+ matches ! (
265
+ self . state,
266
+ BlockState :: GloballyAccepted | BlockState :: GloballyRejected
267
+ )
268
+ }
261
269
}
262
270
263
271
/// This struct manages a SQLite database connection
Original file line number Diff line number Diff line change @@ -550,8 +550,11 @@ impl Signer {
550
550
}
551
551
} ;
552
552
if let Err ( e) = block_info. mark_locally_accepted ( false ) {
553
- warn ! ( "{self}: Failed to mark block as locally accepted: {e:?}" , ) ;
554
- return None ;
553
+ if !block_info. has_reached_consensus ( ) {
554
+ warn ! ( "{self}: Failed to mark block as locally accepted: {e:?}" , ) ;
555
+ return None ;
556
+ }
557
+ block_info. signed_self . get_or_insert ( get_epoch_time_secs ( ) ) ;
555
558
}
556
559
let signature = self
557
560
. private_key
@@ -600,8 +603,10 @@ impl Signer {
600
603
}
601
604
} ;
602
605
if let Err ( e) = block_info. mark_locally_rejected ( ) {
603
- warn ! ( "{self}: Failed to mark block as locally rejected: {e:?}" , ) ;
604
- return None ;
606
+ if !block_info. has_reached_consensus ( ) {
607
+ warn ! ( "{self}: Failed to mark block as locally rejected: {e:?}" , ) ;
608
+ return None ;
609
+ }
605
610
}
606
611
let block_rejection = BlockRejection :: from_validate_rejection (
607
612
block_validate_reject. clone ( ) ,
You can’t perform that action at this time.
0 commit comments