-
Notifications
You must be signed in to change notification settings - Fork 653
Open
Labels
Milestone
Description
The expiration
field of transactions is checked in _apply_transaction()
in db_block.cpp
(code):
fc::time_point_sec now = head_block_time();
FC_ASSERT( trx.expiration <= now + chain_parameters.maximum_time_until_expiration, "",
("trx.expiration",trx.expiration)("now",now)("max_til_exp",chain_parameters.maximum_time_until_expiration));
FC_ASSERT( now <= trx.expiration, "", ("now",now)("trx.exp",trx.expiration) );
head_block_time()
is implemented in db_getter.cpp
(code):
time_point_sec database::head_block_time()const
{
return get( dynamic_global_property_id_type() ).time;
}
The time
field is updated in update_global_dynamic_data()
in db_update.cpp
(code):
void database::update_global_dynamic_data( const signed_block& b )
{
...
modify( _dgp, [&]( dynamic_global_property_object& dgp ){
...
dgp.time = b.timestamp;
...
But _apply_transaction()
is called before update_global_dynamic_data(next_block)
in _apply_block()
(code):
for( const auto& trx : next_block.transactions )
{
apply_transaction( trx, skip );
++_current_trx_in_block;
}
update_global_dynamic_data(next_block);
So theoretically if a transaction's expiration
field is later than last block's timestamp, but earlier than the new block's timestamp, it can still be included in the new block and pass the check? Please let me know if I'm wrong.