pub async fn wait_for_verify(
    sent_txs: SentTransactions,
    timeout: Duration,
    rpc_client: &RpcClient,
) -> Result<(), failure::Error> {
    let serial_ids = sent_txs.op_serial_ids;

    let start = Instant::now();
    let polling_interval = Duration::from_millis(250);
    let mut timer = time::interval(polling_interval);

    // Wait until all the transactions are verified.
    for &id in serial_ids.iter() {
        loop {
            let state = rpc_client.ethop_info(id as u64).await?;
            if state.executed && state.verified {
                log::debug!("deposit (serial_id={}) is verified", id);
                break;
            }
            if start.elapsed() > timeout {
                failure::bail!("[wait_for_verify] Timeout")
            }
            timer.tick().await;
        }
    }

    let tx_hashes = sent_txs.tx_hashes;
    for hash in tx_hashes.iter() {
        loop {
            let state = rpc_client.tx_info(hash.clone()).await?;
            if state.verified {
                log::debug!("{} is verified", hash.to_string());
                break;
            }
            if start.elapsed() > timeout {
                failure::bail!("[wait_for_verify] Timeout")
            }
            timer.tick().await;
        }
    }

    Ok(())
}
/// Waits for all the priority operations and transactions to become a part of some block and get verified.
Waits for all the priority operations and transactions to become a part of some block and get verified.
Waits for all the priority operations and transactions to become a part of some block and get verified .
pub async fn wait_for_verify(
    sent_txs: SentTransactions,
    timeout: Duration,
    rpc_client: &RpcClient,
) -> Result<(), failure::Error> {
    let serial_ids = sent_txs.op_serial_ids;
    let start = Instant::now();
    let polling_interval = Duration::from_millis(250);
    let mut timer = time::interval(polling_interval);
    // Wait until all the transactions are verified.
    for &id in serial_ids.iter() {
        loop {
            let state = rpc_client.ethop_info(id as u64).await?;
            if state.executed && state.verified {
                log::debug!("deposit (serial_id={}) is verified", id);
                break;
            }
            if start.elapsed() > timeout {
                failure::bail!("[wait_for_verify] Timeout")
            }
            timer.tick().await;
        }
    }
    let tx_hashes = sent_txs.tx_hashes;
    for hash in tx_hashes.iter() {
        loop {
            let state = rpc_client.tx_info(hash.clone()).await?;
            if state.verified {
                log::debug!("{} is verified", hash.to_string());
                break;
            }
            if start.elapsed() > timeout {
                failure::bail!("[wait_for_verify] Timeout")
            }
            timer.tick().await;
        }
    }
    Ok(())
}
pub async fn wait_for_verify ( sent_txs : SentTransactions , timeout : Duration , rpc_client : & RpcClient , ) -> Result < ( ) , failure :: Error > { let serial_ids = sent_txs . op_serial_ids ; let start = Instant :: now ( ) ; let polling_interval = Duration :: from_millis ( 250 ) ; let mut timer = time :: interval ( polling_interval ) ; // Wait until all the transactions are verified. for & id in serial_ids . iter ( ) { loop { let state = rpc_client . ethop_info ( id as u64 ) . await ? ; if state . executed && state . verified { log :: debug ! ( " " id ) ; break ; } if start . elapsed ( ) > timeout { failure :: bail ! ( " " ) } timer . tick ( ) . await ; } } let tx_hashes = sent_txs . tx_hashes ; for hash in tx_hashes . iter ( ) { loop { let state = rpc_client . tx_info ( hash . clone ( ) ) . await ? ; if state . verified { log :: debug ! ( " " hash to_string ( ) ) ; break ; } if start . elapsed ( ) > timeout { failure :: bail ! ( " " ) } timer . tick ( ) . await ; } } Ok ( ( ) ) }
Waits for all the priority operations and transactions to become a part of some block and get verified.
Waits for all the priority operations and transactions to become a part of some block and get verified .
sent_txs
SentTransactions
timeout
Duration
rpc_client
&RpcClient