|
|
@ -28,7 +28,8 @@ func TestGenLoadValidator(t *testing.T) { |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal := GenFilePV(tempKeyFile.Name(), tempStateFile.Name()) |
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
height := int64(100) |
|
|
|
privVal.LastSignState.Height = height |
|
|
@ -46,7 +47,8 @@ func TestResetValidator(t *testing.T) { |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal := GenFilePV(tempKeyFile.Name(), tempStateFile.Name()) |
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
|
require.NoError(t, err) |
|
|
|
emptyState := FilePVLastSignState{filePath: tempStateFile.Name()} |
|
|
|
|
|
|
|
// new priv val has empty state
|
|
|
@ -86,9 +88,11 @@ func TestLoadOrGenValidator(t *testing.T) { |
|
|
|
t.Error(err) |
|
|
|
} |
|
|
|
|
|
|
|
privVal := LoadOrGenFilePV(tempKeyFilePath, tempStateFilePath) |
|
|
|
privVal, err := LoadOrGenFilePV(tempKeyFilePath, tempStateFilePath) |
|
|
|
require.NoError(t, err) |
|
|
|
addr := privVal.GetAddress() |
|
|
|
privVal = LoadOrGenFilePV(tempKeyFilePath, tempStateFilePath) |
|
|
|
privVal, err = LoadOrGenFilePV(tempKeyFilePath, tempStateFilePath) |
|
|
|
require.NoError(t, err) |
|
|
|
assert.Equal(addr, privVal.GetAddress(), "expected privval addr to be the same") |
|
|
|
} |
|
|
|
|
|
|
@ -164,7 +168,8 @@ func TestSignVote(t *testing.T) { |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal := GenFilePV(tempKeyFile.Name(), tempStateFile.Name()) |
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
randbytes := tmrand.Bytes(tmhash.Size) |
|
|
|
randbytes2 := tmrand.Bytes(tmhash.Size) |
|
|
@ -217,7 +222,8 @@ func TestSignProposal(t *testing.T) { |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal := GenFilePV(tempKeyFile.Name(), tempStateFile.Name()) |
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
randbytes := tmrand.Bytes(tmhash.Size) |
|
|
|
randbytes2 := tmrand.Bytes(tmhash.Size) |
|
|
@ -265,7 +271,8 @@ func TestDifferByTimestamp(t *testing.T) { |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal := GenFilePV(tempKeyFile.Name(), tempStateFile.Name()) |
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
|
require.NoError(t, err) |
|
|
|
randbytes := tmrand.Bytes(tmhash.Size) |
|
|
|
block1 := types.BlockID{Hash: randbytes, PartSetHeader: types.PartSetHeader{Total: 5, Hash: randbytes}} |
|
|
|
height, round := int64(10), int32(1) |
|
|
|