mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-11-19 02:26:34 +01:00
nip60: fix mutex double-lock issue when saving change.
This commit is contained in:
@@ -159,9 +159,8 @@ func (w *Wallet) saveChangeAndDeleteUsedTokens(
|
|||||||
w.wl.PublishUpdate(*changeToken.event, nil, nil, &changeToken, false)
|
w.wl.PublishUpdate(*changeToken.event, nil, nil, &changeToken, false)
|
||||||
w.wl.Unlock()
|
w.wl.Unlock()
|
||||||
|
|
||||||
w.tokensMu.Lock()
|
// we don't have to lock tokensMu here because this function will always be called with that lock already held
|
||||||
w.Tokens = append(updatedTokens, changeToken)
|
w.Tokens = append(updatedTokens, changeToken)
|
||||||
w.tokensMu.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user