File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,14 @@ impl BlockInfo {
266
266
BlockState :: GloballyAccepted | BlockState :: GloballyRejected
267
267
)
268
268
}
269
+
270
+ /// Check if the block is locally accepted or rejected
271
+ pub fn is_locally_finalized ( & self ) -> bool {
272
+ matches ! (
273
+ self . state,
274
+ BlockState :: LocallyAccepted | BlockState :: LocallyRejected
275
+ )
276
+ }
269
277
}
270
278
271
279
/// This struct manages a SQLite database connection
Original file line number Diff line number Diff line change @@ -538,7 +538,13 @@ impl Signer {
538
538
. signer_db
539
539
. block_lookup ( self . reward_cycle , & signer_signature_hash)
540
540
{
541
- Ok ( Some ( block_info) ) => block_info,
541
+ Ok ( Some ( block_info) ) => {
542
+ if block_info. is_locally_finalized ( ) {
543
+ debug ! ( "{self}: Received block validation for a block that is already marked as {}. Ignoring..." , block_info. state) ;
544
+ return None ;
545
+ }
546
+ block_info
547
+ }
542
548
Ok ( None ) => {
543
549
// We have not seen this block before. Why are we getting a response for it?
544
550
debug ! ( "{self}: Received a block validate response for a block we have not seen before. Ignoring..." ) ;
@@ -591,7 +597,13 @@ impl Signer {
591
597
. signer_db
592
598
. block_lookup ( self . reward_cycle , & signer_signature_hash)
593
599
{
594
- Ok ( Some ( block_info) ) => block_info,
600
+ Ok ( Some ( block_info) ) => {
601
+ if block_info. is_locally_finalized ( ) {
602
+ debug ! ( "{self}: Received block validation for a block that is already marked as {}. Ignoring..." , block_info. state) ;
603
+ return None ;
604
+ }
605
+ block_info
606
+ }
595
607
Ok ( None ) => {
596
608
// We have not seen this block before. Why are we getting a response for it?
597
609
debug ! ( "{self}: Received a block validate response for a block we have not seen before. Ignoring..." ) ;
You can’t perform that action at this time.
0 commit comments