@@ -317,8 +317,14 @@ impl ChainSource {
317
317
) ) ;
318
318
}
319
319
320
+ log_info ! (
321
+ logger,
322
+ "Starting initial synchronization of chain listeners. This might take a while.." ,
323
+ ) ;
324
+
320
325
loop {
321
326
let mut locked_header_cache = header_cache. lock ( ) . await ;
327
+ let now = SystemTime :: now ( ) ;
322
328
match synchronize_listeners (
323
329
bitcoind_rpc_client. as_ref ( ) ,
324
330
config. network ,
@@ -329,6 +335,11 @@ impl ChainSource {
329
335
{
330
336
Ok ( chain_tip) => {
331
337
{
338
+ log_info ! (
339
+ logger,
340
+ "Finished synchronizing listeners in {}ms" ,
341
+ now. elapsed( ) . unwrap( ) . as_millis( )
342
+ ) ;
332
343
* latest_chain_tip. write ( ) . unwrap ( ) = Some ( chain_tip) ;
333
344
let unix_time_secs_opt = SystemTime :: now ( )
334
345
. duration_since ( UNIX_EPOCH )
@@ -374,6 +385,8 @@ impl ChainSource {
374
385
fee_rate_update_interval
375
386
. set_missed_tick_behavior ( tokio:: time:: MissedTickBehavior :: Skip ) ;
376
387
388
+ log_info ! ( logger, "Starting continuous polling for chain updates." ) ;
389
+
377
390
// Start the polling loop.
378
391
loop {
379
392
tokio:: select! {
@@ -692,13 +705,15 @@ impl ChainSource {
692
705
& mut * locked_header_cache,
693
706
& chain_listener,
694
707
) ;
695
- let mut chain_polling_interval =
696
- tokio:: time:: interval ( Duration :: from_secs ( CHAIN_POLLING_INTERVAL_SECS ) ) ;
697
- chain_polling_interval
698
- . set_missed_tick_behavior ( tokio:: time:: MissedTickBehavior :: Skip ) ;
699
708
709
+ let now = SystemTime :: now ( ) ;
700
710
match spv_client. poll_best_tip ( ) . await {
701
711
Ok ( ( ChainTip :: Better ( tip) , true ) ) => {
712
+ log_trace ! (
713
+ logger,
714
+ "Finished polling best tip in {}ms" ,
715
+ now. elapsed( ) . unwrap( ) . as_millis( )
716
+ ) ;
702
717
* latest_chain_tip. write ( ) . unwrap ( ) = Some ( tip) ;
703
718
} ,
704
719
Ok ( _) => { } ,
@@ -711,11 +726,19 @@ impl ChainSource {
711
726
}
712
727
713
728
let cur_height = channel_manager. current_best_block ( ) . height ;
729
+
730
+ let now = SystemTime :: now ( ) ;
714
731
match bitcoind_rpc_client
715
732
. get_mempool_transactions_and_timestamp_at_height ( cur_height)
716
733
. await
717
734
{
718
735
Ok ( unconfirmed_txs) => {
736
+ log_trace ! (
737
+ logger,
738
+ "Finished polling mempool of size {} in {}ms" ,
739
+ unconfirmed_txs. len( ) ,
740
+ now. elapsed( ) . unwrap( ) . as_millis( )
741
+ ) ;
719
742
let _ = onchain_wallet. apply_unconfirmed_txs ( unconfirmed_txs) ;
720
743
} ,
721
744
Err ( e) => {
0 commit comments