@@ -2,7 +2,7 @@ use crate::error::{TxSyncError, InternalError};
2
2
use crate :: common:: { SyncState , FilterQueue , ConfirmedTx } ;
3
3
4
4
use lightning:: util:: logger:: Logger ;
5
- use lightning:: { log_error, log_info , log_debug, log_trace} ;
5
+ use lightning:: { log_error, log_debug, log_trace} ;
6
6
use lightning:: chain:: WatchedOutput ;
7
7
use lightning:: chain:: { Confirm , Filter } ;
8
8
@@ -14,6 +14,7 @@ use esplora_client::r#async::AsyncClient;
14
14
#[ cfg( not( feature = "async-interface" ) ) ]
15
15
use esplora_client:: blocking:: BlockingClient ;
16
16
17
+ use std:: time:: Instant ;
17
18
use std:: collections:: HashSet ;
18
19
use core:: ops:: Deref ;
19
20
89
90
#[ cfg( feature = "async-interface" ) ]
90
91
let mut sync_state = self . sync_state . lock ( ) . await ;
91
92
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 ;
93
97
94
98
let mut tip_hash = maybe_await ! ( self . client. get_tip_hash( ) ) ?;
95
99
@@ -115,7 +119,7 @@ where
115
119
tip_hash = check_tip_hash;
116
120
continue ;
117
121
}
118
-
122
+ num_unconfirmed += unconfirmed_txs . len ( ) ;
119
123
self . sync_unconfirmed_transactions ( & mut sync_state, & confirmables, unconfirmed_txs) ;
120
124
} ,
121
125
Err ( err) => {
@@ -152,6 +156,7 @@ where
152
156
continue ;
153
157
}
154
158
159
+ num_confirmed += confirmed_txs. len ( ) ;
155
160
self . sync_confirmed_transactions (
156
161
& mut sync_state,
157
162
& confirmables,
@@ -175,7 +180,8 @@ where
175
180
sync_state. pending_sync = false ;
176
181
}
177
182
}
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) ;
179
185
Ok ( ( ) )
180
186
}
181
187
0 commit comments