if let Some(progress_bar) = &mut progress_bar { progress_bar.finish_and_clear(); } Ok(()) } fn fetch_blocks_from( index: &Index, mut height: u32, index_sats: bool, ) -> Result> { let (tx, rx) = mpsc::sync_channel(32); let height_limit = index.height_limit; let client = index.options.bitcoin_rpc_client()?; let first_inscription_height = index.first_inscription_height; thread::spawn(move || loop { if let Some(height_limit) = height_limit { if height >= height_limit { break; } } match Self::get_block_with_retries(&client, height, index_sats, first_inscription_height) { Ok(Some(block)) => { if let Err(err) = tx.send(block.into()) { log::info!("Block receiver disconnected: {err}"); break; } height += 1; } Ok(None) => break, Err(err) => { log::error!("failed to fetch block {height}: {err}");