mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-03-28 18:51:53 +01:00
nip60: fix receive proof saving, send nil to Processed, do a dedicated kind:5 filter, hack for initial processing race condition.
This commit is contained in:
parent
794561a3b3
commit
1e76aec884
@ -48,7 +48,7 @@ func (w *Wallet) ReceiveToken(ctx context.Context, serializedToken string) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get new proofs
|
// get new proofs
|
||||||
_, newProofs, err := w.SwapProofs(ctx, source, proofs, proofs.Amount(), swapOpts...)
|
newProofs, _, err := w.SwapProofs(ctx, source, proofs, proofs.Amount(), swapOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ found:
|
|||||||
deleteEvent := nostr.Event{
|
deleteEvent := nostr.Event{
|
||||||
CreatedAt: nostr.Now(),
|
CreatedAt: nostr.Now(),
|
||||||
Kind: 5,
|
Kind: 5,
|
||||||
Tags: nostr.Tags{{"e", token.event.ID}},
|
Tags: nostr.Tags{{"e", token.event.ID}, {"k", "7375"}},
|
||||||
}
|
}
|
||||||
w.wl.kr.SignEvent(ctx, &deleteEvent)
|
w.wl.kr.SignEvent(ctx, &deleteEvent)
|
||||||
w.wl.Changes <- deleteEvent
|
w.wl.Changes <- deleteEvent
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"iter"
|
"iter"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/nbd-wtf/go-nostr"
|
"github.com/nbd-wtf/go-nostr"
|
||||||
@ -46,7 +47,10 @@ func LoadStash(
|
|||||||
events := pool.SubManyNotifyEOSE(
|
events := pool.SubManyNotifyEOSE(
|
||||||
ctx,
|
ctx,
|
||||||
relays,
|
relays,
|
||||||
nostr.Filters{{Kinds: []int{5, 37375, 7375, 7376}, Authors: []string{pk}}},
|
nostr.Filters{
|
||||||
|
{Kinds: []int{37375, 7375, 7376}, Authors: []string{pk}},
|
||||||
|
{Kinds: []int{5}, Tags: nostr.TagMap{"k": []string{"7375"}}, Authors: []string{pk}},
|
||||||
|
},
|
||||||
eoseChan,
|
eoseChan,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -81,6 +85,7 @@ func loadStash(
|
|||||||
}
|
}
|
||||||
wl.pendingDeletions = nil
|
wl.pendingDeletions = nil
|
||||||
|
|
||||||
|
time.Sleep(100 * time.Millisecond) // race condition hack
|
||||||
close(wl.Stable)
|
close(wl.Stable)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -204,6 +209,7 @@ func loadStash(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wl.Processed <- nil
|
||||||
wl.Unlock()
|
wl.Unlock()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user