Skip to content

Commit 76dea22

Browse files
committed
fix: dont exit if block marked as globally accepted/rejected
1 parent 91550e1 commit 76dea22

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

stacks-signer/src/signerdb.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@ impl BlockInfo {
258258
self.state = state;
259259
Ok(())
260260
}
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+
}
261269
}
262270

263271
/// This struct manages a SQLite database connection

stacks-signer/src/v0/signer.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,11 @@ impl Signer {
550550
}
551551
};
552552
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());
555558
}
556559
let signature = self
557560
.private_key
@@ -600,8 +603,10 @@ impl Signer {
600603
}
601604
};
602605
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+
}
605610
}
606611
let block_rejection = BlockRejection::from_validate_rejection(
607612
block_validate_reject.clone(),

0 commit comments

Comments
 (0)