From 73c85c14e13add55049f06c7e9187204e15ea634 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 31 Oct 2018 11:37:40 -0700 Subject: [PATCH] modules/vm: Calc reserve_bytes and obtain sequence numbers later. --- modules/vm.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/vm.cc b/modules/vm.cc index c946803ae..b13beb4ad 100644 --- a/modules/vm.cc +++ b/modules/vm.cc @@ -646,21 +646,14 @@ ircd::m::vm::_eval_pdu(eval &eval, "Signature verification failed" }; - const size_t reserve_bytes - { - opts.reserve_bytes == size_t(-1)? - json::serialized(event): - opts.reserve_bytes - }; + // Fetch dependencies + if(opts.fetch) + fetch_hook(event, eval); // Obtain sequence number here if(opts.write) eval.sequence = ++vm::current_sequence; - // Fetch dependencies - if(opts.fetch) - fetch_hook(event, eval); - // Evaluation by module hooks if(opts.eval) eval_hook(event, eval); @@ -668,6 +661,13 @@ ircd::m::vm::_eval_pdu(eval &eval, if(!opts.write) return fault::ACCEPT; + const size_t reserve_bytes + { + opts.reserve_bytes == size_t(-1)? + json::serialized(event): + opts.reserve_bytes + }; + db::txn txn { *dbs::events, db::txn::opts