chore(pairing): trace which relays accepted each identity RPC

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.
This commit is contained in:
Avi 2026-09-23 09:33:06 -05:00
commit 9cfc1cfeb1

View file

@ -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<Vec<String>, 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())
}
}