@@ -2,7 +2,7 @@ use crate::error::{TxSyncError, InternalError};
22use crate :: common:: { SyncState , FilterQueue , ConfirmedTx } ;
33
44use lightning:: util:: logger:: Logger ;
5- use lightning:: { log_error, log_info , log_debug, log_trace} ;
5+ use lightning:: { log_error, log_debug, log_trace} ;
66use lightning:: chain:: WatchedOutput ;
77use lightning:: chain:: { Confirm , Filter } ;
88
@@ -14,6 +14,7 @@ use esplora_client::r#async::AsyncClient;
1414#[ cfg( not( feature = "async-interface" ) ) ]
1515use esplora_client:: blocking:: BlockingClient ;
1616
17+ use std:: time:: Instant ;
1718use std:: collections:: HashSet ;
1819use core:: ops:: Deref ;
1920
8990 #[ cfg( feature = "async-interface" ) ]
9091 let mut sync_state = self . sync_state . lock ( ) . await ;
9192
92- log_info ! ( self . logger, "Starting transaction sync." ) ;
93+ log_trace ! ( self . logger, "Starting transaction sync." ) ;
94+ let start_time = Instant :: now ( ) ;
95+ let mut num_confirmed = 0 ;
96+ let mut num_unconfirmed = 0 ;
9397
9498 let mut tip_hash = maybe_await ! ( self . client. get_tip_hash( ) ) ?;
9599
@@ -115,7 +119,7 @@ where
115119 tip_hash = check_tip_hash;
116120 continue ;
117121 }
118-
122+ num_unconfirmed += unconfirmed_txs . len ( ) ;
119123 self . sync_unconfirmed_transactions ( & mut sync_state, & confirmables, unconfirmed_txs) ;
120124 } ,
121125 Err ( err) => {
@@ -152,6 +156,7 @@ where
152156 continue ;
153157 }
154158
159+ num_confirmed += confirmed_txs. len ( ) ;
155160 self . sync_confirmed_transactions (
156161 & mut sync_state,
157162 & confirmables,
@@ -175,7 +180,8 @@ where
175180 sync_state. pending_sync = false ;
176181 }
177182 }
178- log_info ! ( self . logger, "Finished transaction sync." ) ;
183+ log_debug ! ( self . logger, "Finished transaction sync at tip {} in {}ms: {} confirmed, {} unconfirmed." ,
184+ tip_hash, start_time. elapsed( ) . as_millis( ) , num_confirmed, num_unconfirmed) ;
179185 Ok ( ( ) )
180186 }
181187
0 commit comments