0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-17 23:40:57 +01: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" "Signature verification failed"
}; };
const size_t reserve_bytes // Fetch dependencies
{ if(opts.fetch)
opts.reserve_bytes == size_t(-1)? fetch_hook(event, eval);
json::serialized(event):
opts.reserve_bytes
};
// Obtain sequence number here // Obtain sequence number here
if(opts.write) if(opts.write)
eval.sequence = ++vm::current_sequence; eval.sequence = ++vm::current_sequence;
// Fetch dependencies
if(opts.fetch)
fetch_hook(event, eval);
// Evaluation by module hooks // Evaluation by module hooks
if(opts.eval) if(opts.eval)
eval_hook(event, eval); eval_hook(event, eval);
@ -668,6 +661,13 @@ ircd::m::vm::_eval_pdu(eval &eval,
if(!opts.write) if(!opts.write)
return fault::ACCEPT; return fault::ACCEPT;
const size_t reserve_bytes
{
opts.reserve_bytes == size_t(-1)?
json::serialized(event):
opts.reserve_bytes
};
db::txn txn db::txn txn
{ {
*dbs::events, db::txn::opts *dbs::events, db::txn::opts