@@ -37,7 +37,7 @@ var testSigData = make([]byte, 32)
3737
3838func TestKeyStore (t * testing.T ) {
3939 t .Parallel ()
40- dir , ks := tmpKeyStore (t , true )
40+ dir , ks := tmpKeyStore (t )
4141
4242 a , err := ks .NewAccount ("foo" )
4343 if err != nil {
@@ -72,7 +72,7 @@ func TestKeyStore(t *testing.T) {
7272
7373func TestSign (t * testing.T ) {
7474 t .Parallel ()
75- _ , ks := tmpKeyStore (t , true )
75+ _ , ks := tmpKeyStore (t )
7676
7777 pass := "" // not used but required by API
7878 a1 , err := ks .NewAccount (pass )
@@ -89,7 +89,7 @@ func TestSign(t *testing.T) {
8989
9090func TestSignWithPassphrase (t * testing.T ) {
9191 t .Parallel ()
92- _ , ks := tmpKeyStore (t , true )
92+ _ , ks := tmpKeyStore (t )
9393
9494 pass := "passwd"
9595 acc , err := ks .NewAccount (pass )
@@ -117,7 +117,7 @@ func TestSignWithPassphrase(t *testing.T) {
117117
118118func TestTimedUnlock (t * testing.T ) {
119119 t .Parallel ()
120- _ , ks := tmpKeyStore (t , true )
120+ _ , ks := tmpKeyStore (t )
121121
122122 pass := "foo"
123123 a1 , err := ks .NewAccount (pass )
@@ -152,7 +152,7 @@ func TestTimedUnlock(t *testing.T) {
152152
153153func TestOverrideUnlock (t * testing.T ) {
154154 t .Parallel ()
155- _ , ks := tmpKeyStore (t , false )
155+ _ , ks := tmpKeyStore (t )
156156
157157 pass := "foo"
158158 a1 , err := ks .NewAccount (pass )
@@ -193,7 +193,7 @@ func TestOverrideUnlock(t *testing.T) {
193193// This test should fail under -race if signing races the expiration goroutine.
194194func TestSignRace (t * testing.T ) {
195195 t .Parallel ()
196- _ , ks := tmpKeyStore (t , false )
196+ _ , ks := tmpKeyStore (t )
197197
198198 // Create a test account.
199199 a1 , err := ks .NewAccount ("" )
@@ -238,7 +238,7 @@ func waitForKsUpdating(t *testing.T, ks *KeyStore, wantStatus bool, maxTime time
238238func TestWalletNotifierLifecycle (t * testing.T ) {
239239 t .Parallel ()
240240 // Create a temporary keystore to test with
241- _ , ks := tmpKeyStore (t , false )
241+ _ , ks := tmpKeyStore (t )
242242
243243 // Ensure that the notification updater is not running yet
244244 time .Sleep (250 * time .Millisecond )
@@ -284,7 +284,7 @@ type walletEvent struct {
284284// or deleted from the keystore.
285285func TestWalletNotifications (t * testing.T ) {
286286 t .Parallel ()
287- _ , ks := tmpKeyStore (t , false )
287+ _ , ks := tmpKeyStore (t )
288288
289289 // Subscribe to the wallet feed and collect events.
290290 var (
@@ -346,7 +346,7 @@ func TestWalletNotifications(t *testing.T) {
346346// TestImportExport tests the import functionality of a keystore.
347347func TestImportECDSA (t * testing.T ) {
348348 t .Parallel ()
349- _ , ks := tmpKeyStore (t , true )
349+ _ , ks := tmpKeyStore (t )
350350 key , err := crypto .GenerateKey ()
351351 if err != nil {
352352 t .Fatalf ("failed to generate key: %v" , key )
@@ -365,7 +365,7 @@ func TestImportECDSA(t *testing.T) {
365365// TestImportECDSA tests the import and export functionality of a keystore.
366366func TestImportExport (t * testing.T ) {
367367 t .Parallel ()
368- _ , ks := tmpKeyStore (t , true )
368+ _ , ks := tmpKeyStore (t )
369369 acc , err := ks .NewAccount ("old" )
370370 if err != nil {
371371 t .Fatalf ("failed to create account: %v" , acc )
@@ -374,7 +374,7 @@ func TestImportExport(t *testing.T) {
374374 if err != nil {
375375 t .Fatalf ("failed to export account: %v" , acc )
376376 }
377- _ , ks2 := tmpKeyStore (t , true )
377+ _ , ks2 := tmpKeyStore (t )
378378 if _ , err = ks2 .Import (json , "old" , "old" ); err == nil {
379379 t .Errorf ("importing with invalid password succeeded" )
380380 }
@@ -394,7 +394,7 @@ func TestImportExport(t *testing.T) {
394394// This test should fail under -race if importing races.
395395func TestImportRace (t * testing.T ) {
396396 t .Parallel ()
397- _ , ks := tmpKeyStore (t , true )
397+ _ , ks := tmpKeyStore (t )
398398 acc , err := ks .NewAccount ("old" )
399399 if err != nil {
400400 t .Fatalf ("failed to create account: %v" , acc )
@@ -403,7 +403,7 @@ func TestImportRace(t *testing.T) {
403403 if err != nil {
404404 t .Fatalf ("failed to export account: %v" , acc )
405405 }
406- _ , ks2 := tmpKeyStore (t , true )
406+ _ , ks2 := tmpKeyStore (t )
407407 var atom atomic.Uint32
408408 var wg sync.WaitGroup
409409 wg .Add (2 )
@@ -457,11 +457,7 @@ func checkEvents(t *testing.T, want []walletEvent, have []walletEvent) {
457457 }
458458}
459459
460- func tmpKeyStore (t * testing.T , encrypted bool ) (string , * KeyStore ) {
460+ func tmpKeyStore (t * testing.T ) (string , * KeyStore ) {
461461 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 )
467463}
0 commit comments