waddrmgr: fix concurrent map access
Fixes lightningnetwork/lnd#5864. The loadAccountInfo does load an account as its name suggests. But after loading it, the account is also added to a map to cache it. That map write should be seen as a writing operation and therefore the _write_ lock must be held, not just the read lock.
This commit is contained in:
parent
45a94de617
commit
b4e83b1f8c
1 changed files with 2 additions and 2 deletions
|
@ -518,8 +518,8 @@ func (s *ScopedKeyManager) loadAccountInfo(ns walletdb.ReadBucket,
|
|||
func (s *ScopedKeyManager) AccountProperties(ns walletdb.ReadBucket,
|
||||
account uint32) (*AccountProperties, error) {
|
||||
|
||||
defer s.mtx.RUnlock()
|
||||
s.mtx.RLock()
|
||||
s.mtx.Lock()
|
||||
defer s.mtx.Unlock()
|
||||
|
||||
props := &AccountProperties{
|
||||
AccountNumber: account,
|
||||
|
|
Loading…
Reference in a new issue