|
|
@ -4,7 +4,6 @@ import ( |
|
|
|
"context" |
|
|
|
"encoding/base64" |
|
|
|
"fmt" |
|
|
|
"io/ioutil" |
|
|
|
"os" |
|
|
|
"testing" |
|
|
|
"time" |
|
|
@ -24,9 +23,9 @@ import ( |
|
|
|
func TestGenLoadValidator(t *testing.T) { |
|
|
|
assert := assert.New(t) |
|
|
|
|
|
|
|
tempKeyFile, err := ioutil.TempFile("", "priv_validator_key_") |
|
|
|
tempKeyFile, err := os.CreateTemp("", "priv_validator_key_") |
|
|
|
require.Nil(t, err) |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
tempStateFile, err := os.CreateTemp("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
@ -44,9 +43,9 @@ func TestGenLoadValidator(t *testing.T) { |
|
|
|
} |
|
|
|
|
|
|
|
func TestResetValidator(t *testing.T) { |
|
|
|
tempKeyFile, err := ioutil.TempFile("", "priv_validator_key_") |
|
|
|
tempKeyFile, err := os.CreateTemp("", "priv_validator_key_") |
|
|
|
require.Nil(t, err) |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
tempStateFile, err := os.CreateTemp("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
@ -76,9 +75,9 @@ func TestResetValidator(t *testing.T) { |
|
|
|
func TestLoadOrGenValidator(t *testing.T) { |
|
|
|
assert := assert.New(t) |
|
|
|
|
|
|
|
tempKeyFile, err := ioutil.TempFile("", "priv_validator_key_") |
|
|
|
tempKeyFile, err := os.CreateTemp("", "priv_validator_key_") |
|
|
|
require.Nil(t, err) |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
tempStateFile, err := os.CreateTemp("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
tempKeyFilePath := tempKeyFile.Name() |
|
|
@ -165,9 +164,9 @@ func TestUnmarshalValidatorKey(t *testing.T) { |
|
|
|
func TestSignVote(t *testing.T) { |
|
|
|
assert := assert.New(t) |
|
|
|
|
|
|
|
tempKeyFile, err := ioutil.TempFile("", "priv_validator_key_") |
|
|
|
tempKeyFile, err := os.CreateTemp("", "priv_validator_key_") |
|
|
|
require.Nil(t, err) |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
tempStateFile, err := os.CreateTemp("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
@ -219,9 +218,9 @@ func TestSignVote(t *testing.T) { |
|
|
|
func TestSignProposal(t *testing.T) { |
|
|
|
assert := assert.New(t) |
|
|
|
|
|
|
|
tempKeyFile, err := ioutil.TempFile("", "priv_validator_key_") |
|
|
|
tempKeyFile, err := os.CreateTemp("", "priv_validator_key_") |
|
|
|
require.Nil(t, err) |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
tempStateFile, err := os.CreateTemp("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
@ -268,9 +267,9 @@ func TestSignProposal(t *testing.T) { |
|
|
|
} |
|
|
|
|
|
|
|
func TestDifferByTimestamp(t *testing.T) { |
|
|
|
tempKeyFile, err := ioutil.TempFile("", "priv_validator_key_") |
|
|
|
tempKeyFile, err := os.CreateTemp("", "priv_validator_key_") |
|
|
|
require.Nil(t, err) |
|
|
|
tempStateFile, err := ioutil.TempFile("", "priv_validator_state_") |
|
|
|
tempStateFile, err := os.CreateTemp("", "priv_validator_state_") |
|
|
|
require.Nil(t, err) |
|
|
|
|
|
|
|
privVal, err := GenFilePV(tempKeyFile.Name(), tempStateFile.Name(), "") |
|
|
|