From 230b40f6b59c120752e5d22754cdc49df19ff835 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 4 Apr 2024 12:23:23 -0500 Subject: [PATCH 1/2] Tag npub if no contact --- mutiny-core/src/hermes.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mutiny-core/src/hermes.rs b/mutiny-core/src/hermes.rs index 77ae4689a..d33079fce 100644 --- a/mutiny-core/src/hermes.rs +++ b/mutiny-core/src/hermes.rs @@ -16,7 +16,7 @@ use lightning::util::logger::Logger; use lightning::{log_error, log_info, log_warn}; use lightning_invoice::Bolt11Invoice; use nostr::prelude::decrypt_received_private_zap_message; -use nostr::{nips::nip04::decrypt, Event, JsonUtil, Keys, Tag}; +use nostr::{nips::nip04::decrypt, Event, JsonUtil, Keys, Tag, ToBech32}; use nostr::{Filter, Kind, Timestamp}; use nostr_sdk::{Client, RelayPoolNotification}; use reqwest::Method; @@ -505,13 +505,13 @@ async fn handle_ecash_notification( // tag the invoice if we can let mut tags = Vec::with_capacity(2); - // try to tag by npub - if let Some((id, _)) = npub - .map(|n| storage.get_contact_for_npub(n)) - .transpose()? - .flatten() - { - tags.push(id); + // try to tag by contact by npub, otherwise tag by pubkey + if let Some(npub) = npub { + if let Some((id, _)) = storage.get_contact_for_npub(npub)? { + tags.push(id); + } else { + tags.push(npub.to_bech32().expect("must be valid")); + } } // add message tag if we have one From b15581008e31940b71f25112d45f0d063d3a97b8 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Thu, 4 Apr 2024 12:45:54 -0500 Subject: [PATCH 2/2] Fix private zap --- mutiny-core/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/mutiny-core/src/lib.rs b/mutiny-core/src/lib.rs index eb9692fb3..1f19fd9d7 100644 --- a/mutiny-core/src/lib.rs +++ b/mutiny-core/src/lib.rs @@ -2578,7 +2578,6 @@ impl MutinyWallet { // Create final zap event let mut tags: Vec = data.into(); tags.push(Tag::Anon { msg: Some(msg) }); - let private_zap_keys: Keys = Keys::generate(); EventBuilder::new(Kind::ZapRequest, "", tags) .custom_created_at(created_at) .to_event(&private_zap_keys)?