SetFSMInConsensusModeForProposals() is how the Validator is configured for `base chain` specific parameter upgrades
()
| 633 | |
| 634 | // SetFSMInConsensusModeForProposals() is how the Validator is configured for `base chain` specific parameter upgrades |
| 635 | func (c *Controller) SetFSMInConsensusModeForProposals() (reset func()) { |
| 636 | elapsed := time.Since(c.Consensus.BFTStartTime).Milliseconds() |
| 637 | // if consensus is below round 3 AND it hasn't been more than 3 minutes since the last block |
| 638 | if c.Consensus.GetRound() < 3 && elapsed < int64(c.Config.BlockTimeMS()*3) { |
| 639 | // if the node is not having 'consensus issues' refer to the approve list |
| 640 | c.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_APPROVE_LIST) |
| 641 | c.Mempool.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_APPROVE_LIST) |
| 642 | } else { |
| 643 | // if the node is exhibiting 'chain halt' like behavior, reject all proposals |
| 644 | c.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_REJECT_ALL) |
| 645 | c.Mempool.FSM.SetProposalVoteConfig(fsm.GovProposalVoteConfig_REJECT_ALL) |
| 646 | } |
| 647 | // a callback that resets the configuration back to default |
| 648 | reset = func() { |
| 649 | // the default is to accept all except in 'Consensus mode' |
| 650 | c.FSM.SetProposalVoteConfig(fsm.AcceptAllProposals) |
| 651 | c.Mempool.FSM.SetProposalVoteConfig(fsm.AcceptAllProposals) |
| 652 | } |
| 653 | return |
| 654 | } |
| 655 | |
| 656 | // UpdateTelemetry() updates the prometheus metrics after 'committing' a block |
| 657 | func (c *Controller) UpdateTelemetry(qc *lib.QuorumCertificate, block *lib.Block, blockProcessingTime time.Duration) { |
no test coverage detected