@@ -735,10 +735,13 @@ where
735
735
& self , contents : T , destination : Destination , reply_path : Option < BlindedPath > ,
736
736
log_suffix : fmt:: Arguments
737
737
) -> Result < SendSuccess , SendError > {
738
- let intro_node_logger =
739
- WithContext :: from ( & self . logger , Some ( destination. first_node ( ) ) , None ) ;
738
+ let mut log_wrapper = WithContext :: from ( & self . logger , None , None ) ;
740
739
let result = self . find_path ( destination)
741
- . and_then ( |path| self . enqueue_onion_message ( path, contents, reply_path, log_suffix) ) ;
740
+ . and_then ( |path| {
741
+ let first_hop = path. intermediate_nodes . get ( 0 ) . map ( |p| * p) ;
742
+ log_wrapper = WithContext :: from ( & self . logger , first_hop, None ) ;
743
+ self . enqueue_onion_message ( path, contents, reply_path, log_suffix)
744
+ } ) ;
742
745
743
746
match result. as_ref ( ) {
744
747
Err ( SendError :: GetNodeIdFailed ) => {
@@ -751,11 +754,11 @@ where
751
754
log_trace ! ( self . logger, "Failed sending onion message {}: {:?}" , log_suffix, e) ;
752
755
} ,
753
756
Ok ( SendSuccess :: Buffered ) => {
754
- log_trace ! ( intro_node_logger , "Buffered onion message {}" , log_suffix) ;
757
+ log_trace ! ( log_wrapper , "Buffered onion message {}" , log_suffix) ;
755
758
} ,
756
759
Ok ( SendSuccess :: BufferedAwaitingConnection ( node_id) ) => {
757
760
log_trace ! (
758
- intro_node_logger ,
761
+ log_wrapper ,
759
762
"Buffered onion message waiting on peer connection {}: {}" ,
760
763
log_suffix, node_id
761
764
) ;
0 commit comments