@@ -478,6 +478,22 @@ impl Signer {
478
478
}
479
479
}
480
480
481
+ /// The actual `send_block_response` implementation. Declared so that we do
482
+ /// not need to duplicate in testing.
483
+ fn impl_send_block_response ( & mut self , block_response : BlockResponse ) {
484
+ let res = self
485
+ . stackerdb
486
+ . send_message_with_retry :: < SignerMessage > ( block_response. clone ( ) . into ( ) ) ;
487
+ match res {
488
+ Err ( e) => warn ! ( "{self}: Failed to send block rejection to stacker-db: {e:?}" ) ,
489
+ Ok ( ack) if !ack. accepted => warn ! (
490
+ "{self}: Block rejection not accepted by stacker-db: {:?}" ,
491
+ ack. reason
492
+ ) ,
493
+ Ok ( _) => debug ! ( "{self}: Block rejection accepted by stacker-db" ) ,
494
+ }
495
+ }
496
+
481
497
#[ cfg( any( test, feature = "testing" ) ) ]
482
498
fn send_block_response ( & mut self , block_response : BlockResponse ) {
483
499
const NUM_REPEATS : usize = 1 ;
@@ -489,17 +505,7 @@ impl Signer {
489
505
count = NUM_REPEATS ;
490
506
}
491
507
while count <= NUM_REPEATS {
492
- let res = self
493
- . stackerdb
494
- . send_message_with_retry :: < SignerMessage > ( block_response. clone ( ) . into ( ) ) ;
495
- match res {
496
- Err ( e) => warn ! ( "{self}: Failed to send block rejection to stacker-db: {e:?}" ) ,
497
- Ok ( ack) if !ack. accepted => warn ! (
498
- "{self}: Block rejection not accepted by stacker-db: {:?}" ,
499
- ack. reason
500
- ) ,
501
- Ok ( _) => debug ! ( "{self}: Block rejection accepted by stacker-db" ) ,
502
- }
508
+ self . impl_send_block_response ( block_response. clone ( ) ) ;
503
509
504
510
count += 1 ;
505
511
sleep_ms ( 1000 ) ;
@@ -508,17 +514,7 @@ impl Signer {
508
514
509
515
#[ cfg( not( any( test, feature = "testing" ) ) ) ]
510
516
fn send_block_response ( & mut self , block_response : BlockResponse ) {
511
- let res = self
512
- . stackerdb
513
- . send_message_with_retry :: < SignerMessage > ( block_response. clone ( ) . into ( ) ) ;
514
- match res {
515
- Err ( e) => warn ! ( "{self}: Failed to send block rejection to stacker-db: {e:?}" ) ,
516
- Ok ( ack) if !ack. accepted => warn ! (
517
- "{self}: Block rejection not accepted by stacker-db: {:?}" ,
518
- ack. reason
519
- ) ,
520
- Ok ( _) => debug ! ( "{self}: Block rejection accepted by stacker-db" ) ,
521
- }
517
+ self . impl_send_block_response ( block_response)
522
518
}
523
519
524
520
/// Handle block proposal messages submitted to signers stackerdb
0 commit comments