mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
proposer selection tests. closes #53
This commit is contained in:
+15
-4
@@ -166,13 +166,16 @@ type ConsensusState struct {
|
||||
|
||||
evsw events.Fireable
|
||||
evc *events.EventCache // set in stageBlock and passed into state
|
||||
|
||||
decideProposalFunc func(cs *ConsensusState, height int, round int)
|
||||
}
|
||||
|
||||
func NewConsensusState(state *sm.State, blockStore *bc.BlockStore, mempoolReactor *mempl.MempoolReactor) *ConsensusState {
|
||||
cs := &ConsensusState{
|
||||
blockStore: blockStore,
|
||||
mempoolReactor: mempoolReactor,
|
||||
newStepCh: make(chan *RoundState, 10),
|
||||
blockStore: blockStore,
|
||||
mempoolReactor: mempoolReactor,
|
||||
newStepCh: make(chan *RoundState, 10),
|
||||
decideProposalFunc: decideProposal,
|
||||
}
|
||||
cs.updateToState(state)
|
||||
// Don't call scheduleRound0 yet.
|
||||
@@ -182,6 +185,10 @@ func NewConsensusState(state *sm.State, blockStore *bc.BlockStore, mempoolReacto
|
||||
return cs
|
||||
}
|
||||
|
||||
func (cs *ConsensusState) SetDecideProposalFunc(f func(cs *ConsensusState, height int, round int)) {
|
||||
cs.decideProposalFunc = f
|
||||
}
|
||||
|
||||
// Reconstruct LastCommit from SeenValidation, which we saved along with the block,
|
||||
// (which happens even before saving the state)
|
||||
func (cs *ConsensusState) reconstructLastCommit(state *sm.State) {
|
||||
@@ -418,8 +425,12 @@ func (cs *ConsensusState) EnterPropose(height int, round int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (cs *ConsensusState) decideProposal(height, round int) {
|
||||
cs.decideProposalFunc(cs, height, round)
|
||||
}
|
||||
|
||||
// Decides on the next proposal and sets them onto cs.Proposal*
|
||||
func (cs *ConsensusState) decideProposal(height int, round int) {
|
||||
func decideProposal(cs *ConsensusState, height, round int) {
|
||||
var block *types.Block
|
||||
var blockParts *types.PartSet
|
||||
|
||||
|
||||
Reference in New Issue
Block a user