Skip to content

Commit e8e51e9

Browse files
committed
chore: improved signer block response logs
1 parent 01f730b commit e8e51e9

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

stacks-signer/src/v0/signer.rs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,10 +1426,28 @@ impl Signer {
14261426
if total_reject_weight.saturating_add(min_weight) <= total_weight {
14271427
// Not enough rejection signatures to make a decision
14281428
let reject_threshold = total_weight.saturating_sub(min_weight).saturating_add(1);
1429-
info!("{self}: Received rejection for block {block_hash}, but have not reached rejection threshold yet (have {total_reject_weight}, need at least {min_weight}/{reject_threshold})");
1429+
info!("{self}: Received block rejection";
1430+
"signer_pubkey" => public_key,
1431+
"signer_signature_hash" => block_hash,
1432+
"consensus_hash" => block_info.block.header.consensus_hash,
1433+
"block_height" => block_info.block.header.chain_length,
1434+
"reject_reason" => ?rejection.response_data.reject_reason,
1435+
"total_weight_rejected" => total_reject_weight,
1436+
"total_weight" => total_weight,
1437+
"percent_rejected" => (total_reject_weight as f64 / total_weight as f64 * 100.0),
1438+
);
14301439
return;
14311440
}
1432-
info!("{self}: Received rejection for block {block_hash} and have reached the rejection threshold with {total_reject_weight}/{total_weight} rejections");
1441+
info!("{self}: Received block rejection and have reached the rejection threshold";
1442+
"signer_pubkey" => public_key,
1443+
"signer_signature_hash" => block_hash,
1444+
"consensus_hash" => block_info.block.header.consensus_hash,
1445+
"block_height" => block_info.block.header.chain_length,
1446+
"reject_reason" => ?rejection.response_data.reject_reason,
1447+
"total_weight_rejected" => total_reject_weight,
1448+
"total_weight" => total_weight,
1449+
"percent_rejected" => (total_reject_weight as f64 / total_weight as f64 * 100.0),
1450+
);
14331451
if let Err(e) = self.signer_db.mark_block_globally_rejected(&mut block_info) {
14341452
warn!("{self}: Failed to mark block as globally rejected: {e:?}",);
14351453
}
@@ -1546,10 +1564,26 @@ impl Signer {
15461564
});
15471565

15481566
if min_weight > signature_weight {
1549-
info!("{self}: Received block acceptance for block {block_hash}, but have not reached threshold yet (have {signature_weight}, need at least {min_weight}/{total_weight})");
1567+
info!("{self}: Received block acceptance";
1568+
"signer_pubkey" => public_key,
1569+
"signer_signature_hash" => block_hash,
1570+
"consensus_hash" => block_info.block.header.consensus_hash,
1571+
"block_height" => block_info.block.header.chain_length,
1572+
"total_weight_approved" => total_weight_approved,
1573+
"total_weight" => total_weight,
1574+
"percent_approved" => (total_weight_approved as f64 / total_weight as f64 * 100.0),
1575+
);
15501576
return;
15511577
}
1552-
info!("{self}: Received block acceptance for block {block_hash} and have reached threshold with {signature_weight}/{total_weight} signatures");
1578+
info!("{self}: Received block acceptance and have reached the threshold";
1579+
"signer_pubkey" => public_key,
1580+
"signer_signature_hash" => block_hash,
1581+
"consensus_hash" => block_info.block.header.consensus_hash,
1582+
"block_height" => block_info.block.header.chain_length,
1583+
"total_weight_approved" => total_weight_approved,
1584+
"total_weight" => total_weight,
1585+
"percent_approved" => (total_weight_approved as f64 / total_weight as f64 * 100.0),
1586+
);
15531587

15541588
// have enough signatures to broadcast!
15551589
// move block to LOCALLY accepted state.

0 commit comments

Comments
 (0)