Fill event_map with all events that will be needed for resolution
parent
8a035880f0
commit
88f3ee489b
|
@ -197,8 +197,8 @@ dependencies = [
|
||||||
"http",
|
"http",
|
||||||
"image",
|
"image",
|
||||||
"log",
|
"log",
|
||||||
"regex",
|
|
||||||
"rand 0.7.3",
|
"rand 0.7.3",
|
||||||
|
"regex",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"ring",
|
"ring",
|
||||||
"rocket",
|
"rocket",
|
||||||
|
|
|
@ -565,7 +565,7 @@ pub async fn send_transaction_message_route<'a>(
|
||||||
for pdu in &body.pdus {
|
for pdu in &body.pdus {
|
||||||
// 1. Is a valid event, otherwise it is dropped.
|
// 1. Is a valid event, otherwise it is dropped.
|
||||||
// Ruma/PduEvent/StateEvent satisfies this
|
// Ruma/PduEvent/StateEvent satisfies this
|
||||||
|
// TODO: ruma may solve this but our `process_incoming_pdu` needs to return a Result then
|
||||||
let (event_id, value) = crate::pdu::process_incoming_pdu(pdu);
|
let (event_id, value) = crate::pdu::process_incoming_pdu(pdu);
|
||||||
|
|
||||||
// 2. Passes signature checks, otherwise event is dropped.
|
// 2. Passes signature checks, otherwise event is dropped.
|
||||||
|
@ -741,16 +741,24 @@ pub async fn send_transaction_message_route<'a>(
|
||||||
let auth_events = fork_states
|
let auth_events = fork_states
|
||||||
.iter()
|
.iter()
|
||||||
.map(|map| {
|
.map(|map| {
|
||||||
db.rooms.auth_events_full(
|
db.rooms
|
||||||
pdu.room_id(),
|
.auth_events_full(
|
||||||
&map.values()
|
pdu.room_id(),
|
||||||
.map(|pdu| pdu.event_id().clone())
|
&map.values()
|
||||||
.collect::<Vec<_>>(),
|
.map(|pdu| pdu.event_id().clone())
|
||||||
)
|
.collect::<Vec<_>>(),
|
||||||
|
)
|
||||||
|
.map(|pdus| pdus.into_iter().map(Arc::new).collect::<Vec<_>>())
|
||||||
})
|
})
|
||||||
.collect();
|
.collect::<Result<Vec<_>>>()?;
|
||||||
|
|
||||||
// Add as much as we can to the `event_map` (less DB hits)
|
// Add everything we will need to event_map
|
||||||
|
event_map.extend(
|
||||||
|
auth_events
|
||||||
|
.iter()
|
||||||
|
.map(|pdus| pdus.iter().map(|pdu| (pdu.event_id().clone(), pdu.clone())))
|
||||||
|
.flatten(),
|
||||||
|
);
|
||||||
event_map.extend(
|
event_map.extend(
|
||||||
incoming_auth_events
|
incoming_auth_events
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
@ -773,7 +781,10 @@ pub async fn send_transaction_message_route<'a>(
|
||||||
.collect::<StateMap<_>>()
|
.collect::<StateMap<_>>()
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
&auth_events,
|
auth_events
|
||||||
|
.into_iter()
|
||||||
|
.map(|pdus| pdus.into_iter().map(|pdu| pdu.event_id().clone()).collect())
|
||||||
|
.collect(),
|
||||||
&mut event_map,
|
&mut event_map,
|
||||||
) {
|
) {
|
||||||
Ok(res) => res
|
Ok(res) => res
|
||||||
|
|
Loading…
Reference in New Issue