make ConsensusParams.EvidenceParams.MaxAge time

Refs #2565
This commit is contained in:
Anton Kaliaev
2018-10-11 15:07:05 +04:00
parent 80562669bf
commit 7e7e4c74ca
15 changed files with 520 additions and 269 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"testing"
"time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@ -386,7 +387,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) {
}
}
func makeParams(blockBytes, blockGas, evidenceAge int64) types.ConsensusParams {
func makeParams(blockBytes, blockGas int64, evidenceAge time.Duration) types.ConsensusParams {
return types.ConsensusParams{
BlockSize: types.BlockSize{
MaxBytes: blockBytes,
@ -403,7 +404,8 @@ func pk() []byte {
}
func TestApplyUpdates(t *testing.T) {
initParams := makeParams(1, 2, 3)
initParams := makeParams(1, 2, 3*time.Second)
newMaxAge := 66 * time.Second
cases := [...]struct {
init types.ConsensusParams
@ -419,14 +421,14 @@ func TestApplyUpdates(t *testing.T) {
MaxGas: 55,
},
},
makeParams(44, 55, 3)},
makeParams(44, 55, 3*time.Second)},
3: {initParams,
abci.ConsensusParams{
EvidenceParams: &abci.EvidenceParams{
MaxAge: 66,
MaxAge: &newMaxAge,
},
},
makeParams(1, 2, 66)},
makeParams(1, 2, 66*time.Second)},
}
for i, tc := range cases {