Skip to content

Commit

Permalink
Clear the pending block if the local node rejected the proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-ds committed Nov 16, 2024
1 parent af08c52 commit b27edf3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 9 additions & 1 deletion linera-core/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2550,7 +2550,15 @@ where
));
};
if manager.can_propose(&identity, round) {
let certificate = self.propose_block(block.clone(), round, manager).await?;
let result = self.propose_block(block.clone(), round, manager).await;
if self.state().pending_block().as_ref() == Some(&block) {
if let Err(ChainClientError::LocalNodeError(_)) = result {
// If we just tried to propose the pending block, and the local node rejected
// the proposal, clear the pending block since we don't want to retry in this case.
self.clear_pending_block();
}
}
let certificate = result?;
Ok(ClientOutcome::Committed(Some(certificate)))
} else {
// TODO(#1424): Local timeout might not match validators' exactly.
Expand Down
2 changes: 0 additions & 2 deletions linera-core/src/unit_tests/client_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2474,8 +2474,6 @@ where
LocalNodeError::WorkerError(WorkerError::ChainError(chain_error))
)) if matches!(*chain_error, ChainError::BlockProposalTooLarge)
);
// TODO(#2906): Remove this once the client properly clears the pending block.
client1.clear_pending_block();

let result = client1.publish_data_blob(large_blob_bytes).await;
assert_matches!(
Expand Down

0 comments on commit b27edf3

Please sign in to comment.