Skip to content

Commit

Permalink
Include client updates for supporting messages when assembling messag…
Browse files Browse the repository at this point in the history
…es to relay from the operational data
  • Loading branch information
romac committed Jul 10, 2023
1 parent 7ec23d1 commit 494c5d1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions crates/relayer/src/link/operational_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,24 @@ impl OperationalData {
relay_path: &RelayPath<ChainA, ChainB>,
) -> Result<TrackedMsgs, LinkError> {
// For zero delay we prepend the client update msgs.
let client_update_msg = if !self.conn_delay_needed() {
let client_update_msgs = if !self.conn_delay_needed() {
let update_height = self.proofs_height.increment();

debug!(
"prepending {} client update at height {}",
self.target, update_height
);

// Fetch the client update message. Vector may be empty if the client already has the header
// for the requested height.
let mut client_update_opt = match self.target {
// Fetch the client update messages.
// Vector may be empty if the client already has the header for the requested height.
match self.target {
OperationalDataTarget::Source => {
relay_path.build_update_client_on_src(update_height)?
}
OperationalDataTarget::Destination => {
relay_path.build_update_client_on_dst(update_height)?
}
};

client_update_opt.pop()
}
} else {
let (client_state, _) = match self.target {
OperationalDataTarget::Source => relay_path
Expand Down Expand Up @@ -205,12 +203,12 @@ impl OperationalData {

if client_state.is_frozen() {
return Ok(TrackedMsgs::new(vec![], self.tracking_id));
} else {
None
}

vec![]
};

let msgs = client_update_msg
let msgs = client_update_msgs
.into_iter()
.chain(self.batch.iter().map(|gm| gm.msg.clone()))
.collect();
Expand Down

0 comments on commit 494c5d1

Please sign in to comment.