mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-18 05:56:37 +00:00
accounts/keystore: use runtime.AddCleanup (#32610)
This commit is contained in:
parent
8dfd30fdd1
commit
1cd004871b
1 changed files with 4 additions and 3 deletions
|
|
@ -99,9 +99,10 @@ func (ks *KeyStore) init(keydir string) {
|
||||||
// TODO: In order for this finalizer to work, there must be no references
|
// TODO: In order for this finalizer to work, there must be no references
|
||||||
// to ks. addressCache doesn't keep a reference but unlocked keys do,
|
// to ks. addressCache doesn't keep a reference but unlocked keys do,
|
||||||
// so the finalizer will not trigger until all timed unlocks have expired.
|
// so the finalizer will not trigger until all timed unlocks have expired.
|
||||||
runtime.SetFinalizer(ks, func(m *KeyStore) {
|
runtime.AddCleanup(ks, func(c *accountCache) {
|
||||||
m.cache.close()
|
c.close()
|
||||||
})
|
}, ks.cache)
|
||||||
|
|
||||||
// Create the initial list of wallets from the cache
|
// Create the initial list of wallets from the cache
|
||||||
accs := ks.cache.accounts()
|
accs := ks.cache.accounts()
|
||||||
ks.wallets = make([]accounts.Wallet, len(accs))
|
ks.wallets = make([]accounts.Wallet, len(accs))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue