Skip to content

Commit

Permalink
refactor: requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Yashk767 committed Apr 11, 2024
1 parent 28cb8c2 commit 9218d2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 1 addition & 3 deletions accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import (
"strings"
)

var (
log = logger.NewLogger()
)
var log = logger.NewLogger()

//This function takes path and password as input and returns new account
func (am *AccountManager) CreateAccount(keystorePath string, password string) accounts.Account {
Expand Down
9 changes: 5 additions & 4 deletions cmd/vote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,19 +280,20 @@ func TestCalculateSecret(t *testing.T) {
accountManager := accounts.NewAccountManager(testKeystorePath)
account := accounts.InitAccountStruct(tt.args.address, tt.args.password, accountManager)
gotSignature, gotSecret, err := cmdUtils.CalculateSecret(account, tt.args.epoch, testKeystorePath, tt.args.chainId)
if (err != nil) != tt.wantErr {
t.Errorf("CalculateSecret() error = %v, wantErr %v", err, tt.wantErr)
return
}

gotSignatureInHash := hex.EncodeToString(gotSignature)
gotSecretInHash := hex.EncodeToString(gotSecret)

if !reflect.DeepEqual(gotSignatureInHash, tt.wantSignature) {
t.Errorf("CalculateSecret() Signature = %v, want %v", gotSignatureInHash, tt.wantSignature)
}
if !reflect.DeepEqual(gotSecretInHash, tt.wantSecret) {
t.Errorf("CalculateSecret() Secret = %v, want %v", gotSecretInHash, tt.wantSecret)
}
if (err != nil) != tt.wantErr {
t.Errorf("CalculateSecret() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
}
Expand Down

0 comments on commit 9218d2f

Please sign in to comment.