mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-17 15:11:21 +00:00
refactor decideProposal in common_test (#3343)
This commit is contained in:
@ -127,20 +127,18 @@ func startTestRound(cs *ConsensusState, height int64, round int) {
|
|||||||
cs.startRoutines(0)
|
cs.startRoutines(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create proposal block from cs1 but sign it with vs
|
// Create proposal block from cs1 but sign it with vs.
|
||||||
func decideProposal(cs1 *ConsensusState, vs *validatorStub, height int64, round int) (proposal *types.Proposal, block *types.Block) {
|
func decideProposal(cs1 *ConsensusState, vs *validatorStub, height int64, round int) (proposal *types.Proposal, block *types.Block) {
|
||||||
cs1.mtx.Lock()
|
cs1.mtx.Lock()
|
||||||
block, blockParts := cs1.createProposalBlock()
|
block, blockParts := cs1.createProposalBlock()
|
||||||
|
validRound := cs1.ValidRound
|
||||||
|
chainID := cs1.state.ChainID
|
||||||
cs1.mtx.Unlock()
|
cs1.mtx.Unlock()
|
||||||
if block == nil { // on error
|
if block == nil {
|
||||||
panic("error creating proposal block")
|
panic("Failed to createProposalBlock. Did you forget to add commit for previous block?")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make proposal
|
// Make proposal
|
||||||
cs1.mtx.RLock()
|
|
||||||
validRound := cs1.ValidRound
|
|
||||||
chainID := cs1.state.ChainID
|
|
||||||
cs1.mtx.RUnlock()
|
|
||||||
polRound, propBlockID := validRound, types.BlockID{block.Hash(), blockParts.Header()}
|
polRound, propBlockID := validRound, types.BlockID{block.Hash(), blockParts.Header()}
|
||||||
proposal = types.NewProposal(height, round, polRound, propBlockID)
|
proposal = types.NewProposal(height, round, polRound, propBlockID)
|
||||||
if err := vs.SignProposal(chainID, proposal); err != nil {
|
if err := vs.SignProposal(chainID, proposal); err != nil {
|
||||||
|
Reference in New Issue
Block a user