relay: fix case where content is empty when adding relay
Lightning-Address: fishcharlie@strike.me Closes: https://github.com/damus-io/damus/issues/1849 Signed-off-by: Charlie Fish <contact@charlie.fish> Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com> Changelog-Fixed: Fix issue where adding relays might not work on corrupted contact lists
This commit is contained in:
committed by
William Casarin
parent
84cfeb1604
commit
f7946b1a7c
@@ -203,8 +203,8 @@ func remove_relay(ev: NostrEvent, current_relays: [RelayDescriptor], keypair: Fu
|
||||
func add_relay(ev: NostrEvent, keypair: FullKeypair, current_relays: [RelayDescriptor], relay: RelayURL, info: RelayInfo) -> NostrEvent? {
|
||||
var relays = ensure_relay_info(relays: current_relays, content: ev.content)
|
||||
|
||||
|
||||
guard relays.index(forKey: relay) == nil else {
|
||||
// If kind:3 content is empty, or if the relay doesn't exist in the list, we want to create a kind:3 event with the new relay
|
||||
guard ev.content.isEmpty || relays.index(forKey: relay) == nil else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user