perf: Don't needlessly sign and re-hash events in send_join

This commit is contained in:
timedout
2026-04-07 19:06:14 +01:00
committed by Ellis Git
parent d041adadc8
commit 09bfe79a44
2 changed files with 2 additions and 7 deletions
+1
View File
@@ -0,0 +1 @@
Fixed "Sender must be a local user" error for make_join, make_knock, and make_leave federation routes. Contributed by @nex.
+1 -7
View File
@@ -71,7 +71,7 @@ async fn create_join_event(
let room_version_id = services.rooms.state.get_room_version(room_id).await?; let room_version_id = services.rooms.state.get_room_version(room_id).await?;
trace!("Generating event ID and converting to canonical json"); trace!("Generating event ID and converting to canonical json");
let Ok((event_id, mut value)) = gen_event_id_canonical_json(pdu, &room_version_id) else { let Ok((event_id, value)) = gen_event_id_canonical_json(pdu, &room_version_id) else {
// Event could not be converted to canonical json // Event could not be converted to canonical json
return Err!(Request(BadJson("Could not convert event to canonical json."))); return Err!(Request(BadJson("Could not convert event to canonical json.")));
}; };
@@ -189,12 +189,6 @@ async fn create_join_event(
} }
} }
trace!("Signing send_join event");
services
.server_keys
.hash_and_sign_event(&mut value, &room_version_id)
.map_err(|e| err!(Request(InvalidParam(warn!("Failed to sign send_join event: {e}")))))?;
let mutex_lock = services let mutex_lock = services
.rooms .rooms
.event_handler .event_handler