From 9cfc1cfeb13f5d3de8240561830d71a2c80f74f7 Mon Sep 17 00:00:00 2001 From: Avi Date: Wed, 23 Sep 2026 09:33:06 -0500 Subject: [PATCH] chore(pairing): trace which relays accepted each identity RPC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Sep 23 08:59 live scan died at get_public_key with the subscribe race already fixed, and a post-hoc relay sweep found neither our request nor Amber's connect reply on any healthy pairing relay — the session lived on damus.io (503-flapping) and nostr.band (handshake-hanger, still enabled in user settings and therefore merged into the pairing set). publish_payload now returns the accepting-relay list and send_rpc traces it for live sessions (rpc published: method=… accepted_by=…, NONE when no relay took the event), so the next scan names the dead relay instead of guessing. --- src/signer/nip46_client.rs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/signer/nip46_client.rs b/src/signer/nip46_client.rs index 628374b..0ea98b3 100644 --- a/src/signer/nip46_client.rs +++ b/src/signer/nip46_client.rs @@ -1139,8 +1139,27 @@ impl Nip46ClientSigner { .insert(id.clone(), PendingRemoteRequest { sender }); let payload = json!({ "id": id, "method": method, "params": params }).to_string(); - self.publish_payload(&client, &keys, &conversation, &peer, &payload) + match self + .publish_payload(&client, &keys, &conversation, &peer, &payload) .await + { + Ok(accepted) => { + if live_relays(&connection.relays) { + pairing_trace(&format!( + "rpc published: method={} id={} accepted_by={}", + method, + &id[..8], + if accepted.is_empty() { + "NONE".to_string() + } else { + accepted.join(",") + } + )); + } + Ok(()) + } + Err(detail) => Err(detail), + } }; if let Err(detail) = send_result { self.inner.lock().await.remote_pending.remove(&id); @@ -1846,7 +1865,7 @@ impl Nip46ClientSigner { conversation: &ConversationKey, peer: &PublicKey, payload: &str, - ) -> Result<(), String> { + ) -> Result, String> { let content = nip44_encrypt(conversation, payload).map_err(|e| e.message().to_string())?; let tag = Tag::parse(["p", peer.to_hex().as_str()]).map_err(|e| format!("{e}"))?; let event = EventBuilder::new(Kind::NostrConnect, content) @@ -1854,11 +1873,11 @@ impl Nip46ClientSigner { .finalize_async(keys) .await .map_err(|e| format!("Could not sign: {e}"))?; - client + let output = client .send_event(&event) .await .map_err(|e| format!("{e}"))?; - Ok(()) + Ok(output.success.keys().map(|u| u.to_string()).collect()) } }