mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-26 13:18:57 +00:00
6c1740eefc
* added todo to hash file in ssz * params and copy of block cache * start hash cache * Hash cache implementation * fixed some comments * fixed promatheus duplicate counter name * removed TODO * change to use special expiration cache * function name fixes junk object generator * naming changes * gazzle fix * added pruning last read data test * fixed gometallinter errors * fix benchmarks and no int64 not serializable * move struct from test * add feature flag * fix merge issues * add featureflag to beacon and validator * featureflag init for tests * added feature flag to all ssz dependent tests * remove setter func * replace k8s tweaked expiration cache to https://github.com/karlseguin/ccache * remove else * change request by preston * added init featureflags to genesis_test * Update shared/ssz/hash_cache.go add dot Co-Authored-By: shayzluf <thezluf@gmail.com> * Update shared/ssz/hash_cache.go Co-Authored-By: shayzluf <thezluf@gmail.com> * Update shared/ssz/hash_cache.go remove extra space Co-Authored-By: shayzluf <thezluf@gmail.com> * Update shared/params/config.go add dot Co-Authored-By: shayzluf <thezluf@gmail.com> * Update shared/featureconfig/config.go remove dot Co-Authored-By: shayzluf <thezluf@gmail.com> * Update shared/featureconfig/config.go remove dot Co-Authored-By: shayzluf <thezluf@gmail.com> * remove powchain from prometheus hash cache name * fixes fron change requests * fix change requests * remove faulty merge test * gazelle fix * fix fmt.sprintf * remove debug binary * fix gazelle
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package accounts
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
|
"github.com/prysmaticlabs/prysm/shared/keystore"
|
|
"github.com/prysmaticlabs/prysm/shared/params"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
)
|
|
|
|
func init() {
|
|
featureconfig.InitFeatureConfig(&featureconfig.FeatureFlagConfig{
|
|
CacheTreeHash: false,
|
|
})
|
|
}
|
|
|
|
func TestNewValidatorAccount_AccountExists(t *testing.T) {
|
|
directory := testutil.TempDir() + "/testkeystore"
|
|
defer os.RemoveAll(directory)
|
|
validatorKey, err := keystore.NewKey(rand.Reader)
|
|
if err != nil {
|
|
t.Fatalf("Cannot create new key: %v", err)
|
|
}
|
|
ks := keystore.NewKeystore(directory)
|
|
if err := ks.StoreKey(directory+params.BeaconConfig().ValidatorPrivkeyFileName, validatorKey, ""); err != nil {
|
|
t.Fatalf("Unable to store key %v", err)
|
|
}
|
|
if err := NewValidatorAccount(directory, ""); err != nil {
|
|
t.Errorf("Should support multiple keys: %v", err)
|
|
}
|
|
files, _ := ioutil.ReadDir(directory)
|
|
if len(files) != 3 {
|
|
t.Errorf("multiple validators were not created only %v files in directory", len(files))
|
|
for _, f := range files {
|
|
t.Errorf("%v\n", f.Name())
|
|
}
|
|
}
|
|
if err := os.RemoveAll(directory); err != nil {
|
|
t.Fatalf("Could not remove directory: %v", err)
|
|
}
|
|
}
|