From aa321f6e7f10a864b6f12fd5843ee308b94d310d Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 29 Aug 2025 16:23:28 -0300 Subject: [PATCH] nip60: calling Processed() on deletes. --- nip60/wallet.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nip60/wallet.go b/nip60/wallet.go index d70ed77..251236e 100644 --- a/nip60/wallet.go +++ b/nip60/wallet.go @@ -10,10 +10,10 @@ import ( "time" "fiatjaf.com/nostr" + "fiatjaf.com/nostr/nip60/client" "github.com/btcsuite/btcd/btcec/v2" "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/elnosh/gonuts/cashu/nuts/nut13" - "fiatjaf.com/nostr/nip60/client" ) // WalletOptions contains options for loading a wallet @@ -41,6 +41,7 @@ type Wallet struct { ) // Processed, if not nil, is called every time a received event is processed + // (do not do any wallet operations while handling this as that will cause a mutex deadlock). Processed func(nostr.Event, error) // Stable is closed when we have gotten an EOSE from all relays @@ -155,6 +156,10 @@ func loadWallet( } } } + + if w.Processed != nil { + w.Processed(ie.Event, nil) + } w.Unlock() } }()