Fix failing tests because clean overwrites resolved_state in resolve fn
This commit is contained in:
parent
55e889a11f
commit
33bb319b45
18
src/lib.rs
18
src/lib.rs
@ -196,19 +196,20 @@ impl StateResolution {
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut resolved_state = StateResolution::iterative_auth_check(
|
let resolved_state = StateResolution::iterative_auth_check(
|
||||||
room_id,
|
room_id,
|
||||||
room_version,
|
room_version,
|
||||||
&sorted_left_events,
|
&sorted_left_events,
|
||||||
&resolved_control, // the control events are added to the final resolved state
|
&resolved_control, // The control events are added to the final resolved state
|
||||||
&mut event_map,
|
&mut event_map,
|
||||||
store,
|
store,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// add unconflicted state to the resolved state
|
// Add unconflicted state to the resolved state
|
||||||
resolved_state.extend(unconflicted.clone());
|
// We do it this way so any resolved_state would overwrite unconflicted
|
||||||
|
let mut clean = unconflicted.clone();
|
||||||
Ok(resolved_state)
|
clean.extend(resolved_state);
|
||||||
|
Ok(clean)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve sets of state events as they come in. Internally `StateResolution` builds a graph
|
/// Resolve sets of state events as they come in. Internally `StateResolution` builds a graph
|
||||||
@ -384,14 +385,15 @@ impl StateResolution {
|
|||||||
room_id,
|
room_id,
|
||||||
room_version,
|
room_version,
|
||||||
&sorted_left_events,
|
&sorted_left_events,
|
||||||
&resolved_control, // the control events are added to the final resolved state
|
&resolved_control, // The control events are added to the final resolved state
|
||||||
&mut event_map,
|
&mut event_map,
|
||||||
store,
|
store,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// add unconflicted state to the resolved state
|
// add unconflicted state to the resolved state
|
||||||
|
// TODO:
|
||||||
|
// CLEAN OVERWRITES ANY DUPLICATE KEYS FROM RESOLVED STATE
|
||||||
resolved_state.extend(clean);
|
resolved_state.extend(clean);
|
||||||
|
|
||||||
Ok(resolved_state)
|
Ok(resolved_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user