@@ -37,7 +37,7 @@ var testSigData = make([]byte, 32)
37
37
38
38
func TestKeyStore (t * testing.T ) {
39
39
t .Parallel ()
40
- dir , ks := tmpKeyStore (t , true )
40
+ dir , ks := tmpKeyStore (t )
41
41
42
42
a , err := ks .NewAccount ("foo" )
43
43
if err != nil {
@@ -72,7 +72,7 @@ func TestKeyStore(t *testing.T) {
72
72
73
73
func TestSign (t * testing.T ) {
74
74
t .Parallel ()
75
- _ , ks := tmpKeyStore (t , true )
75
+ _ , ks := tmpKeyStore (t )
76
76
77
77
pass := "" // not used but required by API
78
78
a1 , err := ks .NewAccount (pass )
@@ -89,7 +89,7 @@ func TestSign(t *testing.T) {
89
89
90
90
func TestSignWithPassphrase (t * testing.T ) {
91
91
t .Parallel ()
92
- _ , ks := tmpKeyStore (t , true )
92
+ _ , ks := tmpKeyStore (t )
93
93
94
94
pass := "passwd"
95
95
acc , err := ks .NewAccount (pass )
@@ -117,7 +117,7 @@ func TestSignWithPassphrase(t *testing.T) {
117
117
118
118
func TestTimedUnlock (t * testing.T ) {
119
119
t .Parallel ()
120
- _ , ks := tmpKeyStore (t , true )
120
+ _ , ks := tmpKeyStore (t )
121
121
122
122
pass := "foo"
123
123
a1 , err := ks .NewAccount (pass )
@@ -152,7 +152,7 @@ func TestTimedUnlock(t *testing.T) {
152
152
153
153
func TestOverrideUnlock (t * testing.T ) {
154
154
t .Parallel ()
155
- _ , ks := tmpKeyStore (t , false )
155
+ _ , ks := tmpKeyStore (t )
156
156
157
157
pass := "foo"
158
158
a1 , err := ks .NewAccount (pass )
@@ -193,7 +193,7 @@ func TestOverrideUnlock(t *testing.T) {
193
193
// This test should fail under -race if signing races the expiration goroutine.
194
194
func TestSignRace (t * testing.T ) {
195
195
t .Parallel ()
196
- _ , ks := tmpKeyStore (t , false )
196
+ _ , ks := tmpKeyStore (t )
197
197
198
198
// Create a test account.
199
199
a1 , err := ks .NewAccount ("" )
@@ -238,7 +238,7 @@ func waitForKsUpdating(t *testing.T, ks *KeyStore, wantStatus bool, maxTime time
238
238
func TestWalletNotifierLifecycle (t * testing.T ) {
239
239
t .Parallel ()
240
240
// Create a temporary keystore to test with
241
- _ , ks := tmpKeyStore (t , false )
241
+ _ , ks := tmpKeyStore (t )
242
242
243
243
// Ensure that the notification updater is not running yet
244
244
time .Sleep (250 * time .Millisecond )
@@ -284,7 +284,7 @@ type walletEvent struct {
284
284
// or deleted from the keystore.
285
285
func TestWalletNotifications (t * testing.T ) {
286
286
t .Parallel ()
287
- _ , ks := tmpKeyStore (t , false )
287
+ _ , ks := tmpKeyStore (t )
288
288
289
289
// Subscribe to the wallet feed and collect events.
290
290
var (
@@ -346,7 +346,7 @@ func TestWalletNotifications(t *testing.T) {
346
346
// TestImportExport tests the import functionality of a keystore.
347
347
func TestImportECDSA (t * testing.T ) {
348
348
t .Parallel ()
349
- _ , ks := tmpKeyStore (t , true )
349
+ _ , ks := tmpKeyStore (t )
350
350
key , err := crypto .GenerateKey ()
351
351
if err != nil {
352
352
t .Fatalf ("failed to generate key: %v" , key )
@@ -365,7 +365,7 @@ func TestImportECDSA(t *testing.T) {
365
365
// TestImportECDSA tests the import and export functionality of a keystore.
366
366
func TestImportExport (t * testing.T ) {
367
367
t .Parallel ()
368
- _ , ks := tmpKeyStore (t , true )
368
+ _ , ks := tmpKeyStore (t )
369
369
acc , err := ks .NewAccount ("old" )
370
370
if err != nil {
371
371
t .Fatalf ("failed to create account: %v" , acc )
@@ -374,7 +374,7 @@ func TestImportExport(t *testing.T) {
374
374
if err != nil {
375
375
t .Fatalf ("failed to export account: %v" , acc )
376
376
}
377
- _ , ks2 := tmpKeyStore (t , true )
377
+ _ , ks2 := tmpKeyStore (t )
378
378
if _ , err = ks2 .Import (json , "old" , "old" ); err == nil {
379
379
t .Errorf ("importing with invalid password succeeded" )
380
380
}
@@ -394,7 +394,7 @@ func TestImportExport(t *testing.T) {
394
394
// This test should fail under -race if importing races.
395
395
func TestImportRace (t * testing.T ) {
396
396
t .Parallel ()
397
- _ , ks := tmpKeyStore (t , true )
397
+ _ , ks := tmpKeyStore (t )
398
398
acc , err := ks .NewAccount ("old" )
399
399
if err != nil {
400
400
t .Fatalf ("failed to create account: %v" , acc )
@@ -403,7 +403,7 @@ func TestImportRace(t *testing.T) {
403
403
if err != nil {
404
404
t .Fatalf ("failed to export account: %v" , acc )
405
405
}
406
- _ , ks2 := tmpKeyStore (t , true )
406
+ _ , ks2 := tmpKeyStore (t )
407
407
var atom atomic.Uint32
408
408
var wg sync.WaitGroup
409
409
wg .Add (2 )
@@ -457,11 +457,7 @@ func checkEvents(t *testing.T, want []walletEvent, have []walletEvent) {
457
457
}
458
458
}
459
459
460
- func tmpKeyStore (t * testing.T , encrypted bool ) (string , * KeyStore ) {
460
+ func tmpKeyStore (t * testing.T ) (string , * KeyStore ) {
461
461
d := t .TempDir ()
462
- newKs := NewPlaintextKeyStore
463
- if encrypted {
464
- newKs = func (kd string ) * KeyStore { return NewKeyStore (kd , veryLightScryptN , veryLightScryptP ) }
465
- }
466
- return d , newKs (d )
462
+ return d , NewKeyStore (d , veryLightScryptN , veryLightScryptP )
467
463
}
0 commit comments