mirror of
https://github.com/matrix-construct/construct
synced 2024-11-15 14:31:11 +01:00
ircd:Ⓜ️:vm: Move DUPCHK into execute_pdu().
This commit is contained in:
parent
e71c89fa86
commit
853064120d
1 changed files with 20 additions and 20 deletions
|
@ -486,26 +486,6 @@ try
|
|||
eval.event_, &_event
|
||||
};
|
||||
|
||||
if(likely(opts.phase[phase::DUPCHK]) && _event.event_id)
|
||||
{
|
||||
const scope_restore eval_phase
|
||||
{
|
||||
eval.phase, phase::DUPCHK
|
||||
};
|
||||
|
||||
// Prevent the same event from being accepted twice.
|
||||
if(likely(!opts.replays) && m::exists(_event.event_id))
|
||||
{
|
||||
if(unlikely(~opts.nothrows & fault::EXISTS))
|
||||
throw error
|
||||
{
|
||||
fault::EXISTS, "Event has already been evaluated."
|
||||
};
|
||||
|
||||
return fault::EXISTS;
|
||||
}
|
||||
}
|
||||
|
||||
return execute_du(eval, _event);
|
||||
}
|
||||
catch(const vm::error &e)
|
||||
|
@ -784,6 +764,26 @@ ircd::m::vm::execute_pdu(eval &eval,
|
|||
opts.auth && !eval.room_internal
|
||||
};
|
||||
|
||||
if(likely(opts.phase[phase::DUPCHK]))
|
||||
{
|
||||
const scope_restore eval_phase
|
||||
{
|
||||
eval.phase, phase::DUPCHK
|
||||
};
|
||||
|
||||
// Prevent the same event from being accepted twice.
|
||||
if(likely(!opts.replays) && m::exists(event_id))
|
||||
{
|
||||
if(unlikely(~opts.nothrows & fault::EXISTS))
|
||||
throw error
|
||||
{
|
||||
fault::EXISTS, "Event has already been evaluated."
|
||||
};
|
||||
|
||||
return fault::EXISTS;
|
||||
}
|
||||
}
|
||||
|
||||
if(unlikely(eval.room_internal && !my(event)))
|
||||
throw error
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue