nip60: fix mutex double-lock issue when saving change.

This commit is contained in:
fiatjaf
2025-01-30 19:56:30 -03:00
parent 2b9c50a220
commit 4200144489

View File

@@ -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