mirror of
https://github.com/fluencelabs/tendermint
synced 2025-05-28 21:51:22 +00:00
It's better read from genDoc than from state.validators when appHeight==0 in replay (#2893)
* optimize addProposalBlockPart * optimize addProposalBlockPart * if ProposalBlockParts and LockedBlockParts both exist,let LockedBlockParts overwrite ProposalBlockParts. * fix tryAddBlock * broadcast lockedBlockParts in higher priority * when appHeight==0, it's better fetch genDoc than state.validators.
This commit is contained in:
parent
56052c0a87
commit
fe3b97fd66
@ -276,7 +276,12 @@ func (h *Handshaker) ReplayBlocks(
|
|||||||
|
|
||||||
// If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain.
|
// If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain.
|
||||||
if appBlockHeight == 0 {
|
if appBlockHeight == 0 {
|
||||||
nextVals := types.TM2PB.ValidatorUpdates(state.NextValidators) // state.Validators would work too.
|
validators := make([]*types.Validator, len(h.genDoc.Validators))
|
||||||
|
for i, val := range h.genDoc.Validators {
|
||||||
|
validators[i] = types.NewValidator(val.PubKey, val.Power)
|
||||||
|
}
|
||||||
|
validatorSet := types.NewValidatorSet(validators)
|
||||||
|
nextVals := types.TM2PB.ValidatorUpdates(validatorSet)
|
||||||
csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams)
|
csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams)
|
||||||
req := abci.RequestInitChain{
|
req := abci.RequestInitChain{
|
||||||
Time: h.genDoc.GenesisTime,
|
Time: h.genDoc.GenesisTime,
|
||||||
|
@ -200,6 +200,9 @@ func (ps *PartSet) Total() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ps *PartSet) AddPart(part *Part) (bool, error) {
|
func (ps *PartSet) AddPart(part *Part) (bool, error) {
|
||||||
|
if ps == nil {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
ps.mtx.Lock()
|
ps.mtx.Lock()
|
||||||
defer ps.mtx.Unlock()
|
defer ps.mtx.Unlock()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user