0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-30 04:38:52 +02:00

modules/vm: Calc reserve_bytes and obtain sequence numbers later.

This commit is contained in:
Jason Volk 2018-10-31 11:37:40 -07:00
parent d59f5c40ad
commit 73c85c14e1

View file

@ -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