From 853064120de2eee4f7ec01e13599f313f80840bc Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Tue, 15 Dec 2020 13:08:38 -0800 Subject: [PATCH] ircd::m::vm: Move DUPCHK into execute_pdu(). --- matrix/vm_execute.cc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/matrix/vm_execute.cc b/matrix/vm_execute.cc index bc209c96b..81a8bc9bc 100644 --- a/matrix/vm_execute.cc +++ b/matrix/vm_execute.cc @@ -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 {