fn step(
        &mut self,
        cmd: Option<WorkerCmd>,
        link: &mut Link<ChainA, ChainB>,
        index: u64,
    ) -> RetryResult<Step, u64> {
        if let Some(cmd) = cmd {
            let result = match cmd {
                WorkerCmd::IbcEvents { batch } => link.a_to_b.update_schedule(batch),

                // Handle the arrival of an event signaling that the
                // source chain has advanced to a new block.
                WorkerCmd::NewBlock {
                    height,
                    new_block: _,
                } => {
                    // Schedule the clearing of pending packets. This may happen once at start,
                    // and may be _forced_ at predefined block intervals.
                    link.a_to_b
                        .schedule_packet_clearing(Some(height), self.clear_packets(height))
                }

                WorkerCmd::ClearPendingPackets => link.a_to_b.schedule_packet_clearing(None, true),

                WorkerCmd::Shutdown => {
                    return RetryResult::Ok(Step::Shutdown);
                }
            };

            if let Err(e) = result {
                error!(
                    path = %self.path.short_name(),
                    "[{}] worker: handling command encountered error: {}",
                    link.a_to_b, e
                );

                return RetryResult::Retry(index);
            }
        }

        if let Err(e) = link
            .a_to_b
            .refresh_schedule()
            .and_then(|_| link.a_to_b.execute_schedule())
        {
            error!(
                "[{}] worker: schedule execution encountered error: {}",
                link.a_to_b, e
            );
            return RetryResult::Retry(index);
        }

        let confirmation_result = link.a_to_b.process_pending_txs();

        RetryResult::Ok(Step::Success(confirmation_result))
    }
/// Receives worker commands, which may be:
///     - IbcEvent => then it updates schedule
///     - NewBlock => schedules packet clearing
///     - Shutdown => exits
///
/// Regardless of the incoming command, this method
/// also refreshes and executes any scheduled operational
/// data that is ready.
Receives worker commands, which may be:
IbcEvent => then it updates schedule
NewBlock => schedules packet clearing
Shutdown => exits

Regardless of the incoming command, this method
also refreshes and executes any scheduled operational
data that is ready.
Receives worker commands which may be : IbcEvent = > then it updates schedule NewBlock = > schedules packet clearing Shutdown = > exits Regardless of the incoming command this method also refreshes and executes any scheduled operational data that is ready .
fn step(
        &mut self,
        cmd: Option<WorkerCmd>,
        link: &mut Link<ChainA, ChainB>,
        index: u64,
    ) -> RetryResult<Step, u64> {
        if let Some(cmd) = cmd {
            let result = match cmd {
                WorkerCmd::IbcEvents { batch } => link.a_to_b.update_schedule(batch),
                // Handle the arrival of an event signaling that the
                // source chain has advanced to a new block.
                WorkerCmd::NewBlock {
                    height,
                    new_block: _,
                } => {
                    // Schedule the clearing of pending packets. This may happen once at start,
                    // and may be _forced_ at predefined block intervals.
                    link.a_to_b
                        .schedule_packet_clearing(Some(height), self.clear_packets(height))
                }
                WorkerCmd::ClearPendingPackets => link.a_to_b.schedule_packet_clearing(None, true),
                WorkerCmd::Shutdown => {
                    return RetryResult::Ok(Step::Shutdown);
                }
            };
            if let Err(e) = result {
                error!(
                    path = %self.path.short_name(),
                    "[{}] worker: handling command encountered error: {}",
                    link.a_to_b, e
                );
                return RetryResult::Retry(index);
            }
        }
        if let Err(e) = link
            .a_to_b
            .refresh_schedule()
            .and_then(|_| link.a_to_b.execute_schedule())
        {
            error!(
                "[{}] worker: schedule execution encountered error: {}",
                link.a_to_b, e
            );
            return RetryResult::Retry(index);
        }
        let confirmation_result = link.a_to_b.process_pending_txs();
        RetryResult::Ok(Step::Success(confirmation_result))
    }
fn step ( & mut self , cmd : Option < WorkerCmd > , link : & mut Link < ChainA , ChainB > , index : u64 , ) -> RetryResult < Step , u64 > { if let Some ( cmd ) = cmd { let result = match cmd { WorkerCmd :: IbcEvents { batch } => link . a_to_b . update_schedule ( batch ) , // Handle the arrival of an event signaling that the // source chain has advanced to a new block. WorkerCmd :: NewBlock { height , new_block : _ , } => { // Schedule the clearing of pending packets. This may happen once at start, // and may be _forced_ at predefined block intervals. link . a_to_b . schedule_packet_clearing ( Some ( height ) , self . clear_packets ( height ) ) } WorkerCmd :: ClearPendingPackets => link . a_to_b . schedule_packet_clearing ( None , true ) , WorkerCmd :: Shutdown => { return RetryResult :: Ok ( Step :: Shutdown ) ; } } ; if let Err ( e ) = result { error ! ( path self path short_name ( ) " " link a_to_b e ) ; return RetryResult :: Retry ( index ) ; } } if let Err ( e ) = link . a_to_b . refresh_schedule ( ) . and_then ( | _ | link . a_to_b . execute_schedule ( ) ) { error ! ( " " link a_to_b e ) ; return RetryResult :: Retry ( index ) ; } let confirmation_result = link . a_to_b . process_pending_txs ( ) ; RetryResult :: Ok ( Step :: Success ( confirmation_result ) ) }
Receives worker commands, which may be:
 IbcEvent => then it updates schedule
 NewBlock => schedules packet clearing
 Shutdown => exits
Receives worker commands which may be : IbcEvent = > then it updates schedule NewBlock = > schedules packet clearing Shutdown = > exits
&mut self
cmd
Option<WorkerCmd>
link
&mut Link<ChainA, ChainB>
index
u64
&mut self
cmd
Option<WorkerCmd>
link
&mut Link<ChainA, ChainB>
index
u64