Skip to content

Commit

Permalink
Don't send chain updates for optimistic clients.
Browse files Browse the repository at this point in the history
  • Loading branch information
christos-h committed Oct 1, 2024
1 parent 02a6ccf commit fa50333
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion linera-core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,8 @@ where
local_node: local_node.clone(),
};
let action = action.clone();
Box::pin(async move { updater.send_chain_update(action).await })
let is_optimistic = self.is_optimistic();
Box::pin(async move { updater.send_chain_update(action, is_optimistic).await })
},
)
.await?;
Expand Down
11 changes: 7 additions & 4 deletions linera-core/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ where
pub async fn send_chain_update(
&mut self,
action: CommunicateAction,
optimistic_client: bool,
) -> Result<LiteVote, NodeError> {
let (target_block_height, chain_id) = match &action {
CommunicateAction::SubmitBlock { proposal, .. } => {
Expand All @@ -391,10 +392,12 @@ where
height, chain_id, ..
} => (*height, *chain_id),
};
// Update the validator with missing information, if needed.
let delivery = CrossChainMessageDelivery::NonBlocking;
self.send_chain_information(chain_id, target_block_height, delivery)
.await?;
if !optimistic_client {
// Update the validator with missing information, if needed.
let delivery = CrossChainMessageDelivery::NonBlocking;
self.send_chain_information(chain_id, target_block_height, delivery)
.await?;
}
// Send the block proposal, certificate or timeout request and return a vote.
let vote = match action {
CommunicateAction::SubmitBlock { proposal, blob_ids } => {
Expand Down

0 comments on commit fa50333

Please sign in to comment.