fix: federation peer-joined updates empty onion addresses
Some checks failed
Some checks failed
When a node was already known (via link-node) but had an empty onion address, the peer-joined handler returned early without updating the onion. Now it patches missing onion/pubkey fields on existing nodes. Also adds update_node() to federation storage and updates the architecture comparison doc with system resources, StartOS/umbrelOS tabs, Web5 section, and comparison view. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -364,7 +364,20 @@ impl RpcHandler {
|
||||
}
|
||||
|
||||
let nodes = federation::load_nodes(&self.config.data_dir).await?;
|
||||
if nodes.iter().any(|n| n.did == did) {
|
||||
if let Some(existing) = nodes.iter().find(|n| n.did == did) {
|
||||
// If already known but missing onion/pubkey, update them
|
||||
if existing.onion.is_empty() || existing.pubkey.is_empty() {
|
||||
let mut updated = existing.clone();
|
||||
if existing.onion.is_empty() && !onion.is_empty() {
|
||||
updated.onion = onion.to_string();
|
||||
}
|
||||
if existing.pubkey.is_empty() && !pubkey.is_empty() {
|
||||
updated.pubkey = pubkey.to_string();
|
||||
}
|
||||
updated.last_seen = Some(chrono::Utc::now().to_rfc3339());
|
||||
federation::update_node(&self.config.data_dir, &updated).await?;
|
||||
info!(peer_did = %did, peer_onion = %onion, "Updated existing peer with missing onion/pubkey");
|
||||
}
|
||||
return Ok(serde_json::json!({ "accepted": true, "already_known": true }));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user