mirror of
https://github.com/matrix-construct/construct
synced 2024-12-28 00:14:07 +01:00
modules/s_fetch: Use vm::eval array constructor here.
This commit is contained in:
parent
c8df604d24
commit
6335a0ce09
1 changed files with 5 additions and 14 deletions
|
@ -462,19 +462,11 @@ ircd::m::fetch::auth_chain(const room &room,
|
|||
|
||||
request.wait(seconds(auth_timeout)); //TODO: conf
|
||||
request.get();
|
||||
const json::array &array
|
||||
const json::array &events
|
||||
{
|
||||
request
|
||||
};
|
||||
|
||||
std::vector<json::object> events(array.count());
|
||||
std::copy(begin(array), end(array), begin(events));
|
||||
std::sort(begin(events), end(events), []
|
||||
(const json::object &a, const json::object &b)
|
||||
{
|
||||
return a.at<uint64_t>("depth") < b.at<uint64_t>("depth");
|
||||
});
|
||||
|
||||
log::debug
|
||||
{
|
||||
log, "Evaluating %zu auth events in chain for %s in %s from %s",
|
||||
|
@ -488,11 +480,10 @@ ircd::m::fetch::auth_chain(const room &room,
|
|||
vmopts.infolog_accept = true;
|
||||
vmopts.fetch_prev_check = false;
|
||||
vmopts.fetch_state_check = false;
|
||||
for(const auto &event : events)
|
||||
m::vm::eval
|
||||
{
|
||||
m::event{event}, vmopts
|
||||
};
|
||||
m::vm::eval
|
||||
{
|
||||
events, vmopts
|
||||
};
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue