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:
parent
2e98e69ddf
commit
9cfc1cfeb1
1 changed files with 23 additions and 4 deletions
|
|
@ -1139,8 +1139,27 @@ impl Nip46ClientSigner {
|
||||||
.insert(id.clone(), PendingRemoteRequest { sender });
|
.insert(id.clone(), PendingRemoteRequest { sender });
|
||||||
|
|
||||||
let payload = json!({ "id": id, "method": method, "params": params }).to_string();
|
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
|
.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 {
|
if let Err(detail) = send_result {
|
||||||
self.inner.lock().await.remote_pending.remove(&id);
|
self.inner.lock().await.remote_pending.remove(&id);
|
||||||
|
|
@ -1846,7 +1865,7 @@ impl Nip46ClientSigner {
|
||||||
conversation: &ConversationKey,
|
conversation: &ConversationKey,
|
||||||
peer: &PublicKey,
|
peer: &PublicKey,
|
||||||
payload: &str,
|
payload: &str,
|
||||||
) -> Result<(), String> {
|
) -> Result<Vec<String>, String> {
|
||||||
let content = nip44_encrypt(conversation, payload).map_err(|e| e.message().to_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 tag = Tag::parse(["p", peer.to_hex().as_str()]).map_err(|e| format!("{e}"))?;
|
||||||
let event = EventBuilder::new(Kind::NostrConnect, content)
|
let event = EventBuilder::new(Kind::NostrConnect, content)
|
||||||
|
|
@ -1854,11 +1873,11 @@ impl Nip46ClientSigner {
|
||||||
.finalize_async(keys)
|
.finalize_async(keys)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("Could not sign: {e}"))?;
|
.map_err(|e| format!("Could not sign: {e}"))?;
|
||||||
client
|
let output = client
|
||||||
.send_event(&event)
|
.send_event(&event)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("{e}"))?;
|
.map_err(|e| format!("{e}"))?;
|
||||||
Ok(())
|
Ok(output.success.keys().map(|u| u.to_string()).collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue