@@ -84,7 +84,20 @@ fn bitcoind_fetcher(
8484 Ok ( Fetcher :: from (
8585 chan. into_receiver ( ) ,
8686 spawn_thread ( "bitcoind_fetcher" , move || {
87+ let mut fetcher_count = 0 ;
88+ let mut blocks_fetched = 0 ;
89+ let total_blocks_fetched = new_headers. len ( ) ;
8790 for entries in new_headers. chunks ( 100 ) {
91+ if fetcher_count % 50 == 0 && total_blocks_fetched >= 50 {
92+ info ! ( "fetching blocks {}/{} ({:.1}%)" ,
93+ blocks_fetched,
94+ total_blocks_fetched,
95+ blocks_fetched as f32 / total_blocks_fetched as f32 * 100.0
96+ ) ;
97+ }
98+ fetcher_count += 1 ;
99+ blocks_fetched += entries. len ( ) ;
100+
88101 let blockhashes: Vec < BlockHash > = entries. iter ( ) . map ( |e| * e. hash ( ) ) . collect ( ) ;
89102 let blocks = daemon
90103 . getblocks ( & blockhashes)
@@ -129,9 +142,17 @@ fn blkfiles_fetcher(
129142 chan. into_receiver ( ) ,
130143 spawn_thread ( "blkfiles_fetcher" , move || {
131144 parser. map ( |sizedblocks| {
145+ let block_count = sizedblocks. len ( ) ;
146+ let mut index = 0 ;
132147 let block_entries: Vec < BlockEntry > = sizedblocks
133148 . into_iter ( )
134149 . filter_map ( |( block, size) | {
150+ index += 1 ;
151+ debug ! ( "fetch block {:}/{:} {:.2}%" ,
152+ index,
153+ block_count,
154+ ( index/block_count) as f32 /100.0
155+ ) ;
135156 let blockhash = block. block_hash ( ) ;
136157 entry_map
137158 . remove ( & blockhash)
@@ -165,7 +186,16 @@ fn blkfiles_reader(blk_files: Vec<PathBuf>, xor_key: Option<[u8; 8]>) -> Fetcher
165186 Fetcher :: from (
166187 chan. into_receiver ( ) ,
167188 spawn_thread ( "blkfiles_reader" , move || {
189+ let mut count = 0 ;
190+ let blk_files_len = blk_files. len ( ) ;
168191 for path in blk_files {
192+ count += 1 ;
193+ info ! ( "block file reading {:}/{:} {:.2}%" ,
194+ count,
195+ blk_files_len,
196+ count / blk_files_len
197+ ) ;
198+
169199 trace ! ( "reading {:?}" , path) ;
170200 let mut blob = fs:: read ( & path)
171201 . unwrap_or_else ( |e| panic ! ( "failed to read {:?}: {:?}" , path, e) ) ;
0 commit comments