Skip to content

Commit 4178fb6

Browse files
committed
fix: comments, cleanup
1 parent 3b2726e commit 4178fb6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stacks-signer/src/v0/signer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ impl Signer {
478478
"burn_height" => block_proposal.burn_height,
479479
);
480480

481-
self.submit_block_for_validation(stacks_client, block_proposal.block.clone());
481+
self.submit_block_for_validation(stacks_client, &block_proposal.block);
482482
} else {
483483
// Still store the block but log we can't submit it for validation. We may receive enough signatures/rejections
484484
// from other signers to push the proposed block into a global rejection/acceptance regardless of our participation.
@@ -503,11 +503,9 @@ impl Signer {
503503
match block_response {
504504
BlockResponse::Accepted(accepted) => {
505505
self.handle_block_signature(stacks_client, accepted);
506-
accepted.signer_signature_hash
507506
}
508507
BlockResponse::Rejected(block_rejection) => {
509508
self.handle_block_rejection(block_rejection);
510-
block_rejection.signer_signature_hash
511509
}
512510
};
513511

@@ -517,6 +515,7 @@ impl Signer {
517515
.remove_pending_block_validation(&signer_sig_hash)
518516
.unwrap_or_else(|e| warn!("{self}: Failed to remove pending block validation: {e:?}"));
519517

518+
// Check if there is a pending block validation that we need to submit to the node
520519
match self.signer_db.get_pending_block_validation() {
521520
Ok(Some(signer_sig_hash)) => {
522521
info!("{self}: Found a pending block validation: {signer_sig_hash:?}");
@@ -525,7 +524,7 @@ impl Signer {
525524
.block_lookup(self.reward_cycle, &signer_sig_hash)
526525
{
527526
Ok(Some(block_info)) => {
528-
self.submit_block_for_validation(stacks_client, block_info.block);
527+
self.submit_block_for_validation(stacks_client, &block_info.block);
529528
}
530529
Ok(None) => {
531530
// This should never happen
@@ -1066,15 +1065,16 @@ impl Signer {
10661065
}
10671066

10681067
/// Submit a block for validation, and mark it as pending if the node
1069-
fn submit_block_for_validation(&mut self, stacks_client: &StacksClient, block: NakamotoBlock) {
1068+
/// is busy with a previous request.
1069+
fn submit_block_for_validation(&mut self, stacks_client: &StacksClient, block: &NakamotoBlock) {
10701070
let signer_signature_hash = block.header.signer_signature_hash();
10711071
match stacks_client.submit_block_for_validation(block.clone()) {
10721072
Ok(_) => {
10731073
self.submitted_block_proposal = Some((signer_signature_hash, Instant::now()));
10741074
}
10751075
Err(ClientError::RequestFailure(status)) => {
10761076
if status.as_u16() == TOO_MANY_REQUESTS_STATUS {
1077-
info!("{self}: Received 429 from stacks node. Inserting pending block validation...";
1077+
info!("{self}: Received 429 from stacks node for block validation request. Inserting pending block validation...";
10781078
"signer_signature_hash" => %signer_signature_hash,
10791079
);
10801080
self.signer_db

0 commit comments

Comments
 (0)