(&mut self, tminfo: &TimeoutInfo)
| 972 | } |
| 973 | |
| 974 | fn timeout_process(&mut self, tminfo: &TimeoutInfo) { |
| 975 | if tminfo.height < self.height { |
| 976 | return; |
| 977 | } |
| 978 | if tminfo.height == self.height && tminfo.round < self.round { |
| 979 | return; |
| 980 | } |
| 981 | if tminfo.height == self.height && tminfo.round == self.round && tminfo.step != self.step { |
| 982 | return; |
| 983 | } |
| 984 | |
| 985 | match tminfo.step { |
| 986 | Step::ProposeWait => { |
| 987 | self.change_to_step(Step::Prevote); |
| 988 | self.transmit_prevote(); |
| 989 | if self.check_prevote_count() { |
| 990 | self.change_to_step(Step::PrevoteWait); |
| 991 | } |
| 992 | } |
| 993 | Step::Prevote => { |
| 994 | self.transmit_prevote(); |
| 995 | } |
| 996 | Step::PrevoteWait => { |
| 997 | // if there is no lock, clear the proposal |
| 998 | if self.lock_status.is_none() { |
| 999 | self.proposal = None; |
| 1000 | } |
| 1001 | // next do precommit |
| 1002 | self.change_to_step(Step::Precommit); |
| 1003 | #[cfg(feature = "verify_req")] |
| 1004 | { |
| 1005 | let verify_result = self.check_verify(); |
| 1006 | if verify_result == VerifyResult::Undetermined { |
| 1007 | self.change_to_step(Step::VerifyWait); |
| 1008 | return; |
| 1009 | } |
| 1010 | } |
| 1011 | |
| 1012 | self.transmit_precommit(); |
| 1013 | let precommit_result = self.check_precommit_count(); |
| 1014 | |
| 1015 | if precommit_result == PRECOMMIT_ON_NOTHING { |
| 1016 | // only receive +2/3 precommits might lead BFT to PrecommitWait |
| 1017 | self.change_to_step(Step::PrecommitWait); |
| 1018 | } |
| 1019 | |
| 1020 | if precommit_result == PRECOMMIT_ON_NIL { |
| 1021 | if self.lock_status.is_none() { |
| 1022 | self.proposal = None; |
| 1023 | } |
| 1024 | self.goto_next_round(); |
| 1025 | self.new_round_start(); |
| 1026 | } |
| 1027 | if precommit_result == PRECOMMIT_ON_PROPOSAL { |
| 1028 | self.change_to_step(Step::Commit); |
| 1029 | self.proc_commit(); |
| 1030 | self.change_to_step(Step::CommitWait); |
| 1031 | } |
no test coverage detected