fn download_needed_headers(
        &self,
        txid_height: &HashMap<Txid, Option<u32>>,
        txs_details_in_db: &HashMap<Txid, TransactionDetails>,
        chunk_size: usize,
    ) -> Result<HashMap<Txid, u64>, Error> {
        let mut txid_timestamp = HashMap::new();
        let txid_in_db_with_conf: HashSet<_> = txs_details_in_db
            .values()
            .filter_map(|details| details.confirmation_time.as_ref().map(|_| details.txid))
            .collect();
        let needed_txid_height: HashMap<&Txid, u32> = txid_height
            .iter()
            .filter(|(t, _)| !txid_in_db_with_conf.contains(*t))
            .filter_map(|(t, o)| o.map(|h| (t, h)))
            .collect();
        let needed_heights: HashSet<u32> = needed_txid_height.values().cloned().collect();
        if !needed_heights.is_empty() {
            info!("{} headers to download for timestamp", needed_heights.len());
            let mut height_timestamp: HashMap<u32, u64> = HashMap::new();
            for chunk in ChunksIterator::new(needed_heights.into_iter(), chunk_size) {
                let call_result: Vec<BlockHeader> =
                    maybe_await!(self.els_batch_block_header(chunk.clone()))?;
                height_timestamp.extend(
                    chunk
                        .into_iter()
                        .zip(call_result.iter().map(|h| h.time as u64)),
                );
            }
            for (txid, height) in needed_txid_height {
                let timestamp = height_timestamp
                    .get(&height)
                    .ok_or_else(|| Error::Generic("timestamp missing".to_string()))?;
                txid_timestamp.insert(*txid, *timestamp);
            }
        }

        Ok(txid_timestamp)
    }
/// download headers at heights in `txid_height` if tx details not already present, returns a map Txid -> timestamp
download headers at heights in `txid_height` if tx details not already present, returns a map Txid -> timestamp
download headers at heights in ` txid_height ` if tx details not already present returns a map Txid - > timestamp
fn download_needed_headers(
        &self,
        txid_height: &HashMap<Txid, Option<u32>>,
        txs_details_in_db: &HashMap<Txid, TransactionDetails>,
        chunk_size: usize,
    ) -> Result<HashMap<Txid, u64>, Error> {
        let mut txid_timestamp = HashMap::new();
        let txid_in_db_with_conf: HashSet<_> = txs_details_in_db
            .values()
            .filter_map(|details| details.confirmation_time.as_ref().map(|_| details.txid))
            .collect();
        let needed_txid_height: HashMap<&Txid, u32> = txid_height
            .iter()
            .filter(|(t, _)| !txid_in_db_with_conf.contains(*t))
            .filter_map(|(t, o)| o.map(|h| (t, h)))
            .collect();
        let needed_heights: HashSet<u32> = needed_txid_height.values().cloned().collect();
        if !needed_heights.is_empty() {
            info!("{} headers to download for timestamp", needed_heights.len());
            let mut height_timestamp: HashMap<u32, u64> = HashMap::new();
            for chunk in ChunksIterator::new(needed_heights.into_iter(), chunk_size) {
                let call_result: Vec<BlockHeader> =
                    maybe_await!(self.els_batch_block_header(chunk.clone()))?;
                height_timestamp.extend(
                    chunk
                        .into_iter()
                        .zip(call_result.iter().map(|h| h.time as u64)),
                );
            }
            for (txid, height) in needed_txid_height {
                let timestamp = height_timestamp
                    .get(&height)
                    .ok_or_else(|| Error::Generic("timestamp missing".to_string()))?;
                txid_timestamp.insert(*txid, *timestamp);
            }
        }
        Ok(txid_timestamp)
    }
fn download_needed_headers ( & self , txid_height : & HashMap < Txid , Option < u32 > > , txs_details_in_db : & HashMap < Txid , TransactionDetails > , chunk_size : usize , ) -> Result < HashMap < Txid , u64 > , Error > { let mut txid_timestamp = HashMap :: new ( ) ; let txid_in_db_with_conf : HashSet < _ > = txs_details_in_db . values ( ) . filter_map ( | details | details . confirmation_time . as_ref ( ) . map ( | _ | details . txid ) ) . collect ( ) ; let needed_txid_height : HashMap < & Txid , u32 > = txid_height . iter ( ) . filter ( | ( t , _ ) | ! txid_in_db_with_conf . contains ( * t ) ) . filter_map ( | ( t , o ) | o . map ( | h | ( t , h ) ) ) . collect ( ) ; let needed_heights : HashSet < u32 > = needed_txid_height . values ( ) . cloned ( ) . collect ( ) ; if ! needed_heights . is_empty ( ) { info ! ( " " needed_heights len ( ) ) ; let mut height_timestamp : HashMap < u32 , u64 > = HashMap :: new ( ) ; for chunk in ChunksIterator :: new ( needed_heights . into_iter ( ) , chunk_size ) { let call_result : Vec < BlockHeader > = maybe_await ! ( self els_batch_block_header ( chunk clone ( ) ) ) ? ; height_timestamp . extend ( chunk . into_iter ( ) . zip ( call_result . iter ( ) . map ( | h | h . time as u64 ) ) , ) ; } for ( txid , height ) in needed_txid_height { let timestamp = height_timestamp . get ( & height ) . ok_or_else ( | | Error :: Generic ( " " . to_string ( ) ) ) ? ; txid_timestamp . insert ( * txid , * timestamp ) ; } } Ok ( txid_timestamp ) }
download headers at heights in `txid_height` if tx details not already present, returns a map Txid -> timestamp
download headers at heights in ` txid_height ` if tx details not already present returns a map Txid - > timestamp
&self
txid_height
&HashMap<Txid, Option<u32>>
txs_details_in_db
&HashMap<Txid, TransactionDetails>
chunk_size
usize
&self
txid_height
&HashMap<Txid, Option<u32>>
txs_details_in_db
&HashMap<Txid, TransactionDetails>
chunk_size
usize