Skip to content

Commit

Permalink
nip60: fix mutex double-lock issue when saving change.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Jan 30, 2025
1 parent 2b9c50a commit 4200144
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions nip60/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ func (w *Wallet) saveChangeAndDeleteUsedTokens(
w.wl.PublishUpdate(*changeToken.event, nil, nil, &changeToken, false)
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.tokensMu.Unlock()
}

return nil
Expand Down

0 comments on commit 4200144

Please # to comment.