Skip to content

Commit befd09a

Browse files
committed
Properly handle block rejection case in handle_block_validate_ok
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 7d63003 commit befd09a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

stacks-signer/src/v0/signer.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,6 +1153,7 @@ impl Signer {
11531153
&mut self,
11541154
stacks_client: &StacksClient,
11551155
block_validate_ok: &BlockValidateOk,
1156+
sortition_state: &mut Option<SortitionsView>,
11561157
) -> Option<BlockResponse> {
11571158
crate::monitoring::actions::increment_block_validation_responses(true);
11581159
let signer_signature_hash = block_validate_ok.signer_signature_hash;
@@ -1192,17 +1193,18 @@ impl Signer {
11921193
if let Some(block_response) =
11931194
self.check_block_against_signer_db_state(stacks_client, &block_info.block)
11941195
{
1196+
let block_rejection = block_response.as_block_rejection()?;
11951197
// The signer db state has changed. We no longer view this block as valid. Override the validation response.
11961198
if let Err(e) = block_info.mark_locally_rejected() {
11971199
if !block_info.has_reached_consensus() {
11981200
warn!("{self}: Failed to mark block as locally rejected: {e:?}");
11991201
}
12001202
};
1201-
self.impl_send_block_response(Some(&block_info.block), block_response);
12021203
self.signer_db
12031204
.insert_block(&block_info)
12041205
.unwrap_or_else(|e| self.handle_insert_block_error(e));
1205-
None
1206+
self.handle_block_rejection(block_rejection, sortition_state);
1207+
Some(block_response)
12061208
} else {
12071209
if let Err(e) = block_info.mark_locally_accepted(false) {
12081210
if !block_info.has_reached_consensus() {
@@ -1292,7 +1294,7 @@ impl Signer {
12921294
crate::monitoring::actions::record_block_validation_latency(
12931295
block_validate_ok.validation_time_ms,
12941296
);
1295-
self.handle_block_validate_ok(stacks_client, block_validate_ok)
1297+
self.handle_block_validate_ok(stacks_client, block_validate_ok, sortition_state)
12961298
}
12971299
BlockValidateResponse::Reject(block_validate_reject) => {
12981300
self.handle_block_validate_reject(block_validate_reject, sortition_state)

0 commit comments

Comments
 (0)