aboutsummaryrefslogtreecommitdiffstats
path: root/src/transport
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-27 01:34:15 +0100
committertv <tv@krebsco.de>2026-10-27 01:34:15 +0100
commit027a0920b81e7ee3e0f3eb4f0b3cbbb559133252 (patch)
treeeb3f0c51ad6594cb1515d28fcec839cdaf69156e /src/transport
parent3b2773500379d14c7611eacc62c4709c1b406fd3 (diff)
admit nodeId and addresses in the API
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/identity.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/transport/identity.rs b/src/transport/identity.rs
index 712e1f9..6f000d0 100644
--- a/src/transport/identity.rs
+++ b/src/transport/identity.rs
@@ -49,6 +49,17 @@ const MAX_HINTS: usize = 8;
/// anyone can send us proofs (keys are free), so the books are bounded.
const MAX_ENTRIES: usize = 4096;
+/// A send refused because the peer hasn't proven where it is yet (`send_encoded`):
+/// expected when a peer known only from hints is first contacted, and retried.
+#[derive(Debug, thiserror::Error)]
+#[error("{0} hasn't proven where it is yet; asked where it is said to be")]
+pub(crate) struct NotProven(String);
+
+/// Whether `error` is (or was caused by) a [`NotProven`].
+pub(crate) fn is_not_proven(error: &anyhow::Error) -> bool {
+ error.chain().any(|cause| cause.is::<NotProven>())
+}
+
/// What a node under the identity layer needs (`node::NodeConfig::identity`).
#[derive(Clone)]
pub(crate) struct IdentityConfig {
@@ -426,10 +437,7 @@ impl Transport for IdentityTransport {
for target in hints {
self.shared.ask(&target, false);
}
- bail!(
- "{} hasn't proven where it is yet; asked where it is said to be",
- message.peer
- );
+ return Err(NotProven(message.peer.clone()).into());
}
let mut inner = message.clone();
inner.peer = message.address.clone();