mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-20 23:14:37 +00:00
fixes for ProposerAddress
- state.MakeBlock takes a proposerAddr
- validateBlock only checks that the ProposerAddress is in the validator
set
- fix raceyness from bad proposer test:
- use privValidator to get the proposer address (instead of racy
state)
- note we had to remove the test that checked the correct proposer was
included for higher rounds because we don't have a good way to test
this with multiple consensus states and not using the
privValidator.Address while calling createProposalBlock was a hack!
This commit is contained in:
+6
-2
@@ -99,12 +99,14 @@ func (state State) IsEmpty() bool {
|
||||
// Create a block from the latest state
|
||||
|
||||
// MakeBlock builds a block from the current state with the given txs, commit,
|
||||
// and evidence.
|
||||
// and evidence. Note it also takes a proposerAddress because the state does not
|
||||
// track rounds, and hence doesn't know the correct proposer. TODO: alleviate this!
|
||||
func (state State) MakeBlock(
|
||||
height int64,
|
||||
txs []types.Tx,
|
||||
commit *types.Commit,
|
||||
evidence []types.Evidence,
|
||||
proposerAddress []byte,
|
||||
) (*types.Block, *types.PartSet) {
|
||||
|
||||
// Build base block with block data.
|
||||
@@ -122,7 +124,9 @@ func (state State) MakeBlock(
|
||||
block.AppHash = state.AppHash
|
||||
block.LastResultsHash = state.LastResultsHash
|
||||
|
||||
block.ProposerAddress = state.Validators.GetProposer().Address
|
||||
// NOTE: we can't use the state.Validators because we don't
|
||||
// IncrementAccum for rounds there.
|
||||
block.ProposerAddress = proposerAddress
|
||||
|
||||
return block, block.MakePartSet(state.ConsensusParams.BlockGossip.BlockPartSizeBytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user