fix: assign iroh gossip topic to pre-message when post-message is received

Iroh-Gossip-Topic is sent in a post-message. Post-message goes to trash,
so topic should be associated with the existing pre-message that is
updated rather than with the post-message.
This commit is contained in:
link2xt
2026-02-16 21:26:40 +00:00
committed by l
parent a63f695b85
commit 2131f5e9c0
4 changed files with 59 additions and 18 deletions

View File

@@ -521,6 +521,18 @@ pub(crate) async fn create_iroh_header(ctx: &Context, msg_id: MsgId) -> Result<S
Ok(topic_string)
}
/// Converts `Iroh-Gossip-Header` contents to iroh topic ID.
pub(crate) fn iroh_topic_from_str(topic: &str) -> Result<TopicId> {
let mut topic_raw = [0u8; 32];
BASE32_NOPAD
.decode_mut(topic.to_ascii_uppercase().as_bytes(), &mut topic_raw)
.map_err(|e| e.error)
.context("Wrong gossip topic header")?;
let topic = TopicId::from_bytes(topic_raw);
Ok(topic)
}
async fn subscribe_loop(
context: &Context,
mut stream: iroh_gossip::net::GossipReceiver,