Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag npub if no contact #1109

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions mutiny-core/src/hermes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -505,13 +505,13 @@ async fn handle_ecash_notification<S: MutinyStorage>(
// 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
Expand Down
1 change: 0 additions & 1 deletion mutiny-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,6 @@ impl<S: MutinyStorage> MutinyWallet<S> {
// Create final zap event
let mut tags: Vec<Tag> = 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)?
Expand Down
Loading