Skip to content

Commit

Permalink
correct bad comments about dm logging and improve error message for s…
Browse files Browse the repository at this point in the history
…cheduling/cacelling deferred transactions
  • Loading branch information
linh2931 committed Mar 2, 2023
1 parent 4a3b81c commit 2ae98cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void apply_context::execute_context_free_inline( action&& a ) {


void apply_context::schedule_deferred_transaction( const uint128_t& sender_id, account_name payer, transaction&& trx, bool replace_existing ) {
EOS_ASSERT( !trx_context.is_read_only(), transaction_exception, "cannot schedule a readonly deferred transaction" );
EOS_ASSERT( !trx_context.is_read_only(), transaction_exception, "cannot schedule a deferred transaction from within a readonly transaction" );
EOS_ASSERT( trx.context_free_actions.size() == 0, cfa_inside_generated_tx, "context free actions are not currently allowed in generated transactions" );

bool enforce_actor_whitelist_blacklist = trx_context.enforce_whiteblacklist && control.is_speculative_block()
Expand Down Expand Up @@ -627,7 +627,7 @@ void apply_context::schedule_deferred_transaction( const uint128_t& sender_id, a
}

bool apply_context::cancel_deferred_transaction( const uint128_t& sender_id, account_name sender ) {
EOS_ASSERT( !trx_context.is_read_only(), transaction_exception, "cannot cancel a readonly deferred transaction" );
EOS_ASSERT( !trx_context.is_read_only(), transaction_exception, "cannot cancel a deferred transaction from within a readonly transaction" );
auto& generated_transaction_idx = db.get_mutable_index<generated_transaction_multi_index>();
const auto* gto = db.find<generated_transaction_object,by_sender_id>(boost::make_tuple(sender, sender_id));
if ( gto ) {
Expand Down
8 changes: 4 additions & 4 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ struct controller_impl {
dm_logger->on_ram_trace(RAM_EVENT_ID("${name}", ("name", name)), "account", "add", "newaccount");
}

resource_limits.add_pending_ram_usage(name, ram_delta, false); // false for not doing dm logging
resource_limits.add_pending_ram_usage(name, ram_delta, false); // false for doing dm logging
resource_limits.verify_account_ram_usage(name);
}

Expand Down Expand Up @@ -1210,7 +1210,7 @@ struct controller_impl {
}

int64_t ram_delta = -(config::billable_size_v<generated_transaction_object> + gto.packed_trx.size());
resource_limits.add_pending_ram_usage( gto.payer, ram_delta, false ); // false for not doing dm logging
resource_limits.add_pending_ram_usage( gto.payer, ram_delta, false ); // false for doing dm logging
// No need to verify_account_ram_usage since we are only reducing memory

db.remove( gto );
Expand Down Expand Up @@ -3613,7 +3613,7 @@ void controller::replace_account_keys( name account, name permission, const publ
p.auth = authority(key);
});
int64_t new_size = (int64_t)(chain::config::billable_size_v<permission_object> + perm->auth.get_billable_size());
rlm.add_pending_ram_usage(account, new_size - old_size, false); // false for not doing dm logging
rlm.add_pending_ram_usage(account, new_size - old_size, false); // false for doing dm logging
rlm.verify_account_ram_usage(account);
}

Expand Down Expand Up @@ -3659,7 +3659,7 @@ void controller_impl::on_activation<builtin_protocol_feature_t::replace_deferred
dm_logger->on_ram_trace(RAM_EVENT_ID("${id}", ("id", itr->id._id)), "deferred_trx", "correction", "deferred_trx_ram_correction");
}

resource_limits.add_pending_ram_usage( itr->name, ram_delta, false ); // false for not doing dm logging
resource_limits.add_pending_ram_usage( itr->name, ram_delta, false ); // false for doing dm logging
db.remove( *itr );
}
}
Expand Down

0 comments on commit 2ae98cb

Please sign in to comment.