@@ -54,8 +54,8 @@ pub static EVENT_RECEIVER_POLL: Duration = Duration::from_millis(500);
54
54
pub struct BlockStatus {
55
55
pub responded_signers : HashSet < StacksPublicKey > ,
56
56
pub gathered_signatures : BTreeMap < u32 , MessageSignature > ,
57
- pub total_weight_signed : u32 ,
58
- pub total_reject_weight : u32 ,
57
+ pub total_weight_approved : u32 ,
58
+ pub total_weight_rejected : u32 ,
59
59
}
60
60
61
61
#[ derive( Debug , Clone ) ]
@@ -312,14 +312,17 @@ impl StackerDBListener {
312
312
"signer_slot_id" => slot_id,
313
313
"signature" => %signature,
314
314
"signer_weight" => signer_entry. weight,
315
- "total_weight_signed" => block. total_weight_signed,
315
+ "total_weight_approved" => block. total_weight_approved,
316
+ "percent_approved" => block. total_weight_approved as f64 / self . total_weight as f64 * 100.0 ,
317
+ "total_weight_rejected" => block. total_weight_rejected,
318
+ "percent_rejected" => block. total_weight_rejected as f64 / self . total_weight as f64 * 100.0 ,
316
319
) ;
317
320
continue ;
318
321
}
319
322
320
323
if !block. gathered_signatures . contains_key ( & slot_id) {
321
- block. total_weight_signed = block
322
- . total_weight_signed
324
+ block. total_weight_approved = block
325
+ . total_weight_approved
323
326
. checked_add ( signer_entry. weight )
324
327
. expect ( "FATAL: total weight signed exceeds u32::MAX" ) ;
325
328
}
@@ -330,14 +333,18 @@ impl StackerDBListener {
330
333
"signer_slot_id" => slot_id,
331
334
"signature" => %signature,
332
335
"signer_weight" => signer_entry. weight,
333
- "total_weight_signed" => block. total_weight_signed,
336
+ "total_weight_approved" => block. total_weight_approved,
337
+ "percent_approved" => block. total_weight_approved as f64 / self . total_weight as f64 * 100.0 ,
338
+ "total_weight_rejected" => block. total_weight_rejected,
339
+ "percent_rejected" => block. total_weight_rejected as f64 / self . total_weight as f64 * 100.0 ,
340
+ "weight_threshold" => self . weight_threshold,
334
341
"tenure_extend_timestamp" => tenure_extend_timestamp,
335
342
"server_version" => metadata. server_version,
336
343
) ;
337
344
block. gathered_signatures . insert ( slot_id, signature) ;
338
345
block. responded_signers . insert ( signer_pubkey) ;
339
346
340
- if block. total_weight_signed >= self . weight_threshold {
347
+ if block. total_weight_approved >= self . weight_threshold {
341
348
// Signal to anyone waiting on this block that we have enough signatures
342
349
cvar. notify_all ( ) ;
343
350
}
@@ -378,8 +385,8 @@ impl StackerDBListener {
378
385
}
379
386
} ;
380
387
block. responded_signers . insert ( rejected_pubkey) ;
381
- block. total_reject_weight = block
382
- . total_reject_weight
388
+ block. total_weight_rejected = block
389
+ . total_weight_rejected
383
390
. checked_add ( signer_entry. weight )
384
391
. expect ( "FATAL: total weight rejected exceeds u32::MAX" ) ;
385
392
@@ -389,15 +396,19 @@ impl StackerDBListener {
389
396
"signer_slot_id" => slot_id,
390
397
"signature" => %rejected_data. signature,
391
398
"signer_weight" => signer_entry. weight,
392
- "total_weight_signed" => block. total_weight_signed,
399
+ "total_weight_approved" => block. total_weight_approved,
400
+ "percent_approved" => block. total_weight_approved as f64 / self . total_weight as f64 * 100.0 ,
401
+ "total_weight_rejected" => block. total_weight_rejected,
402
+ "percent_rejected" => block. total_weight_rejected as f64 / self . total_weight as f64 * 100.0 ,
403
+ "weight_threshold" => self . weight_threshold,
393
404
"reason" => rejected_data. reason,
394
405
"reason_code" => ?rejected_data. reason_code,
395
406
"tenure_extend_timestamp" => rejected_data. response_data. tenure_extend_timestamp,
396
407
"server_version" => rejected_data. metadata. server_version,
397
408
) ;
398
409
399
410
if block
400
- . total_reject_weight
411
+ . total_weight_rejected
401
412
. saturating_add ( self . weight_threshold )
402
413
> self . total_weight
403
414
{
@@ -479,8 +490,8 @@ impl StackerDBListenerComms {
479
490
let block_status = BlockStatus {
480
491
responded_signers : HashSet :: new ( ) ,
481
492
gathered_signatures : BTreeMap :: new ( ) ,
482
- total_weight_signed : 0 ,
483
- total_reject_weight : 0 ,
493
+ total_weight_approved : 0 ,
494
+ total_weight_rejected : 0 ,
484
495
} ;
485
496
blocks. insert ( block. signer_signature_hash ( ) , block_status) ;
486
497
}
0 commit comments