Skip to content

Commit

Permalink
Merge pull request #5766 from stacks-network/fix/always-send-pending-…
Browse files Browse the repository at this point in the history
…validation

fix: always send pending block validation after receiving a block validation result
  • Loading branch information
hstove authored Jan 29, 2025
2 parents 2233e5e + 9b0f233 commit 1f97bcf
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions stacks-signer/src/v0/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -818,31 +818,32 @@ impl Signer {
.remove_pending_block_validation(&signer_sig_hash)
.unwrap_or_else(|e| warn!("{self}: Failed to remove pending block validation: {e:?}"));

let Some(response) = block_response else {
return;
};
// Submit a proposal response to the .signers contract for miners
info!(
"{self}: Broadcasting a block response to stacks node: {response:?}";
);
let accepted = matches!(response, BlockResponse::Accepted(..));
match self
.stackerdb
.send_message_with_retry::<SignerMessage>(response.into())
{
Ok(_) => {
crate::monitoring::actions::increment_block_responses_sent(accepted);
if let Ok(Some(block_info)) = self
.signer_db
.block_lookup(&block_validate_response.signer_signature_hash())
{
crate::monitoring::actions::record_block_response_latency(&block_info.block);
if let Some(response) = block_response {
// Submit a proposal response to the .signers contract for miners
info!(
"{self}: Broadcasting a block response to stacks node: {response:?}";
);
let accepted = matches!(response, BlockResponse::Accepted(..));
match self
.stackerdb
.send_message_with_retry::<SignerMessage>(response.into())
{
Ok(_) => {
crate::monitoring::actions::increment_block_responses_sent(accepted);
if let Ok(Some(block_info)) = self
.signer_db
.block_lookup(&block_validate_response.signer_signature_hash())
{
crate::monitoring::actions::record_block_response_latency(
&block_info.block,
);
}
}
Err(e) => {
warn!("{self}: Failed to send block rejection to stacker-db: {e:?}",);
}
}
Err(e) => {
warn!("{self}: Failed to send block rejection to stacker-db: {e:?}",);
}
}
};

// Check if there is a pending block validation that we need to submit to the node
match self.signer_db.get_and_remove_pending_block_validation() {
Expand Down

0 comments on commit 1f97bcf

Please sign in to comment.