Skip to content

Commit

Permalink
Change pruning predicate to prune existing messages from the same val…
Browse files Browse the repository at this point in the history
…idator
  • Loading branch information
moshababo committed Jan 23, 2024
1 parent 500b17f commit 677b467
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
9 changes: 2 additions & 7 deletions node/actors/bft/src/leader/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,9 @@ impl StateMachine {
if pending_req.msg.key != new_req.msg.key {
return false;
}

match (&pending_req.msg.msg, &new_req.msg.msg) {
(ConsensusMsg::ReplicaPrepare(existing_msg), ConsensusMsg::ReplicaPrepare(new_msg)) => {
new_msg.view > existing_msg.view
}
(ConsensusMsg::ReplicaCommit(existing_msg), ConsensusMsg::ReplicaCommit(new_msg)) => {
new_msg.view > existing_msg.view
}
(ConsensusMsg::ReplicaPrepare(_), ConsensusMsg::ReplicaPrepare(_)) => true,
(ConsensusMsg::ReplicaCommit(_), ConsensusMsg::ReplicaCommit(_)) => true,
_ => false,
}
}
Expand Down
8 changes: 2 additions & 6 deletions node/actors/bft/src/replica/state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,8 @@ impl StateMachine {
return false;
}
match (&pending_req.msg.msg, &new_req.msg.msg) {
(ConsensusMsg::LeaderPrepare(existing_msg), ConsensusMsg::LeaderPrepare(new_msg)) => {
new_msg.view > existing_msg.view
}
(ConsensusMsg::LeaderCommit(existing_msg), ConsensusMsg::LeaderCommit(new_msg)) => {
new_msg.justification.message.view > existing_msg.justification.message.view
}
(ConsensusMsg::LeaderPrepare(_), ConsensusMsg::LeaderPrepare(_)) => true,
(ConsensusMsg::LeaderCommit(_), ConsensusMsg::LeaderCommit(_)) => true,
_ => false,
}
}
Expand Down

0 comments on commit 677b467

Please sign in to comment.