return Err(err); } thread::sleep(Duration::from_secs(seconds)); } Ok(result) => return Ok(result), } } } fn spawn_fetcher(index: &Index) -> Result<(Sender, Receiver)> { let fetcher = Fetcher::new(&index.options)?; // Not sure if any block has more than 20k inputs, but none so far after first inscription block const CHANNEL_BUFFER_SIZE: usize = 20_000; let (outpoint_sender, mut outpoint_receiver) = tokio::sync::mpsc::channel::(CHANNEL_BUFFER_SIZE); let (value_sender, value_receiver) = tokio::sync::mpsc::channel::(CHANNEL_BUFFER_SIZE); // Batch 2048 missing inputs at a time. Arbitrarily chosen for now, maybe higher or lower can be faster? // Did rudimentary benchmarks with 1024 and 4096 and time was roughly the same. const BATCH_SIZE: usize = 2048; // Default rpcworkqueue in bitcoind is 16, meaning more than 16 concurrent requests will be rejected. // Since we are already requesting blocks on a separate thread, and we don't want to break if anything