transport: mark path response announce entries

This commit is contained in:
DeFiDude committed 2026-05-20 12:02:57 -06:00
1 parent ffe641b3af
commit 6a4e3af78a
3 files changed
+23 -9

No files matched your search

+2
View File
@@ -456,6 +456,7 @@ mod tests {
public_key: Some([0x11; 64]),
ratchet: None,
name_hash: [0; 10],
is_path_response: false,
retained: false,
},
AnnounceRpcEntry {
@@ -466,6 +467,7 @@ mod tests {
public_key: Some([0x22; 64]),
ratchet: None,
name_hash: [0; 10],
is_path_response: false,
retained: false,
},
];
+18 -9
View File
@@ -129,15 +129,24 @@ impl TransportActor {
let mut entries: Vec<AnnounceRpcEntry> = self
.recent_announces
.values()
.map(|a| AnnounceRpcEntry {
dest_hash: a.dest_hash,
hops: a.hops,
app_data: a.app_data.clone(),
timestamp: a.timestamp,
public_key: a.public_key,
ratchet: a.ratchet,
name_hash: a.name_hash,
retained: a.retained,
.map(|a| {
let is_path_response =
rns_wire::header::PacketHeader::unpack(&a.raw_packet)
.ok()
.is_some_and(|(header, _)| {
header.context == rns_wire::context::PacketContext::PathResponse
});
AnnounceRpcEntry {
dest_hash: a.dest_hash,
hops: a.hops,
app_data: a.app_data.clone(),
timestamp: a.timestamp,
public_key: a.public_key,
ratchet: a.ratchet,
name_hash: a.name_hash,
is_path_response,
retained: a.retained,
}
})
.collect();
// HashMap iteration order is unspecified; sort newest-first
+3
View File
@@ -598,6 +598,9 @@ pub struct AnnounceRpcEntry {
pub ratchet: Option<[u8; 32]>,
/// `SHA-256(app_name)[:10]` for the announced aspect.
pub name_hash: [u8; 10],
/// True when the cached announce arrived as a path response instead of a
/// fresh network announce.
pub is_path_response: bool,
/// Pinned via `RetainDestination`; the maintenance sweep skips the
/// entry regardless of age while this is `true`.
pub retained: bool,