@@ -684,12 +684,6 @@ mod tests {
684
684
) -> Option < NodeAnnouncement > {
685
685
None
686
686
}
687
- fn peer_connected (
688
- & self , _their_node_id : PublicKey , _init_msg : & Init , _inbound : bool ,
689
- ) -> Result < ( ) , ( ) > {
690
- Ok ( ( ) )
691
- }
692
- fn peer_disconnected ( & self , _their_node_id : PublicKey ) { }
693
687
fn handle_reply_channel_range (
694
688
& self , _their_node_id : PublicKey , _msg : ReplyChannelRange ,
695
689
) -> Result < ( ) , LightningError > {
@@ -710,12 +704,6 @@ mod tests {
710
704
) -> Result < ( ) , LightningError > {
711
705
Ok ( ( ) )
712
706
}
713
- fn provided_node_features ( & self ) -> NodeFeatures {
714
- NodeFeatures :: empty ( )
715
- }
716
- fn provided_init_features ( & self , _their_node_id : PublicKey ) -> InitFeatures {
717
- InitFeatures :: empty ( )
718
- }
719
707
fn processing_queue_high ( & self ) -> bool {
720
708
false
721
709
}
@@ -766,35 +754,39 @@ mod tests {
766
754
& self , _their_node_id : PublicKey , _msg : PeerStorageRetrieval ,
767
755
) {
768
756
}
757
+ fn handle_channel_reestablish ( & self , _their_node_id : PublicKey , _msg : & ChannelReestablish ) {
758
+ }
759
+ fn handle_error ( & self , _their_node_id : PublicKey , _msg : & ErrorMessage ) { }
760
+ fn get_chain_hashes ( & self ) -> Option < Vec < ChainHash > > {
761
+ Some ( vec ! [ ChainHash :: using_genesis_block( Network :: Testnet ) ] )
762
+ }
763
+ fn message_received ( & self ) { }
764
+ }
765
+ impl BaseMessageHandler for MsgHandler {
769
766
fn peer_disconnected ( & self , their_node_id : PublicKey ) {
770
767
if their_node_id == self . expected_pubkey {
771
768
self . disconnected_flag . store ( true , Ordering :: SeqCst ) ;
772
- self . pubkey_disconnected . clone ( ) . try_send ( ( ) ) . unwrap ( ) ;
769
+ // This method is called twice as we're two message handlers. `try_send` will fail
770
+ // the second time.
771
+ let _ = self . pubkey_disconnected . clone ( ) . try_send ( ( ) ) ;
773
772
}
774
773
}
775
774
fn peer_connected (
776
775
& self , their_node_id : PublicKey , _init_msg : & Init , _inbound : bool ,
777
776
) -> Result < ( ) , ( ) > {
778
777
if their_node_id == self . expected_pubkey {
779
- self . pubkey_connected . clone ( ) . try_send ( ( ) ) . unwrap ( ) ;
778
+ // This method is called twice as we're two message handlers. `try_send` will fail
779
+ // the second time.
780
+ let _ = self . pubkey_connected . clone ( ) . try_send ( ( ) ) ;
780
781
}
781
782
Ok ( ( ) )
782
783
}
783
- fn handle_channel_reestablish ( & self , _their_node_id : PublicKey , _msg : & ChannelReestablish ) {
784
- }
785
- fn handle_error ( & self , _their_node_id : PublicKey , _msg : & ErrorMessage ) { }
786
784
fn provided_node_features ( & self ) -> NodeFeatures {
787
785
NodeFeatures :: empty ( )
788
786
}
789
787
fn provided_init_features ( & self , _their_node_id : PublicKey ) -> InitFeatures {
790
788
InitFeatures :: empty ( )
791
789
}
792
- fn get_chain_hashes ( & self ) -> Option < Vec < ChainHash > > {
793
- Some ( vec ! [ ChainHash :: using_genesis_block( Network :: Testnet ) ] )
794
- }
795
- fn message_received ( & self ) { }
796
- }
797
- impl MessageSendEventsProvider for MsgHandler {
798
790
fn get_and_clear_pending_msg_events ( & self ) -> Vec < MessageSendEvent > {
799
791
let mut ret = Vec :: new ( ) ;
800
792
mem:: swap ( & mut * self . msg_events . lock ( ) . unwrap ( ) , & mut ret) ;
0 commit comments