mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-10 12:01:18 +00:00
replace PB2TM.ConsensusParams with a call to params#Update (#3448)
Fixes #3444
This commit is contained in:
parent
660bd4a53e
commit
1d4afb179b
@ -324,7 +324,7 @@ func (h *Handshaker) ReplayBlocks(
|
||||
}
|
||||
|
||||
if res.ConsensusParams != nil {
|
||||
state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams, state.ConsensusParams.Block.TimeIotaMs)
|
||||
state.ConsensusParams = state.ConsensusParams.Update(res.ConsensusParams)
|
||||
}
|
||||
sm.SaveState(h.stateDB, state)
|
||||
}
|
||||
|
@ -220,36 +220,3 @@ func (pb2tm) ValidatorUpdates(vals []abci.ValidatorUpdate) ([]*Validator, error)
|
||||
}
|
||||
return tmVals, nil
|
||||
}
|
||||
|
||||
// BlockParams.TimeIotaMs is not exposed to the application. Therefore a caller
|
||||
// must provide it.
|
||||
func (pb2tm) ConsensusParams(csp *abci.ConsensusParams, blockTimeIotaMs int64) ConsensusParams {
|
||||
params := ConsensusParams{
|
||||
Block: BlockParams{},
|
||||
Evidence: EvidenceParams{},
|
||||
Validator: ValidatorParams{},
|
||||
}
|
||||
|
||||
// we must defensively consider any structs may be nil
|
||||
if csp.Block != nil {
|
||||
params.Block = BlockParams{
|
||||
MaxBytes: csp.Block.MaxBytes,
|
||||
MaxGas: csp.Block.MaxGas,
|
||||
TimeIotaMs: blockTimeIotaMs,
|
||||
}
|
||||
}
|
||||
|
||||
if csp.Evidence != nil {
|
||||
params.Evidence = EvidenceParams{
|
||||
MaxAge: csp.Evidence.MaxAge,
|
||||
}
|
||||
}
|
||||
|
||||
if csp.Validator != nil {
|
||||
params.Validator = ValidatorParams{
|
||||
PubKeyTypes: csp.Validator.PubKeyTypes,
|
||||
}
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func TestABCIValidators(t *testing.T) {
|
||||
func TestABCIConsensusParams(t *testing.T) {
|
||||
cp := DefaultConsensusParams()
|
||||
abciCP := TM2PB.ConsensusParams(cp)
|
||||
cp2 := PB2TM.ConsensusParams(abciCP, cp.Block.TimeIotaMs)
|
||||
cp2 := cp.Update(abciCP)
|
||||
|
||||
assert.Equal(t, *cp, cp2)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user