From d96fe8996386c87e107e8d0fa050d2c8d7716a67 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 23 Apr 2024 16:44:31 +0800 Subject: [PATCH] feat: accept conversation --- accounts/keystore/keystore.go | 5 +++-- cmd/utils/history_test.go | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accounts/keystore/keystore.go b/accounts/keystore/keystore.go index b9184a2334..df3dda60b6 100644 --- a/accounts/keystore/keystore.go +++ b/accounts/keystore/keystore.go @@ -312,8 +312,9 @@ func (ks *KeyStore) Unlock(a accounts.Account, passphrase string) error { // Lock removes the private key with the given address from memory. func (ks *KeyStore) Lock(addr common.Address) error { ks.mu.Lock() - defer ks.mu.Unlock() - if unl, found := ks.unlocked[addr]; found { + unl, found := ks.unlocked[addr] + ks.mu.Unlock() + if found { ks.expire(addr, unl, time.Duration(0)*time.Nanosecond) } return nil diff --git a/cmd/utils/history_test.go b/cmd/utils/history_test.go index 520a0d84cd..b6703c59ed 100644 --- a/cmd/utils/history_test.go +++ b/cmd/utils/history_test.go @@ -113,7 +113,6 @@ func TestHistoryImportAndExport(t *testing.T) { if err != nil { t.Fatalf("error opening era file: %v", err) } - defer f.Close() var ( h = sha256.New() buf = bytes.NewBuffer(nil)