Fix parent hints

This commit is contained in:
Jon Staab
2024-03-05 16:32:06 -08:00
parent cc8f77726a
commit 25cca2935f
+22 -10
View File
@@ -117,19 +117,31 @@ export class Router {
...this.getContextRelayGroups(event),
])
EventParent = (event: UnsignedEvent) =>
this.scenario([
Tags.fromEvent(event).replies().relays().valueOf(),
this.options.getPubkeyRelays(event.pubkey, RelayMode.Inbox),
...this.getContextRelayGroups(event),
])
EventParent = (event: UnsignedEvent) => {
const tags = Tags.fromEvent(event)
EventRoot = (event: UnsignedEvent) =>
this.scenario([
Tags.fromEvent(event).roots().relays().valueOf(),
this.options.getPubkeyRelays(event.pubkey, RelayMode.Inbox),
return this.scenario([
tags.replies().relays().valueOf(),
...this.getContextRelayGroups(event),
...tags.whereKey("p").values().valueOf()
.map(pk => this.options.getPubkeyRelays(pk, RelayMode.Outbox)),
tags.whereKey("p").relays().valueOf(),
this.options.getPubkeyRelays(event.pubkey, RelayMode.Inbox),
])
}
EventRoot = (event: UnsignedEvent) => {
const tags = Tags.fromEvent(event)
return this.scenario([
tags.roots().relays().valueOf(),
...this.getContextRelayGroups(event),
...tags.whereKey("p").values().valueOf()
.map(pk => this.options.getPubkeyRelays(pk, RelayMode.Outbox)),
tags.whereKey("p").relays().valueOf(),
this.options.getPubkeyRelays(event.pubkey, RelayMode.Inbox),
])
}
PublishEvent = (event: UnsignedEvent) => {
const tags = Tags.fromEvent(event)