Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #832 from EOSIO/statfixes
Browse files Browse the repository at this point in the history
potential fix for de-sync due to subjective differences in time
  • Loading branch information
heifner authored Nov 30, 2017
2 parents 2c76c67 + 698556e commit cf60c2e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions libraries/chain/chain_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const generated_transaction& chain_controller::get_generated_transaction( const
*/
bool chain_controller::push_block(const signed_block& new_block, uint32_t skip)
{ try {
return with_skip_flags( skip, [&](){
return with_skip_flags( skip | received_block, [&](){
return without_pending_transactions( [&]() {
return _db.with_write_lock( [&]() {
return _push_block(new_block);
Expand Down Expand Up @@ -228,7 +228,7 @@ bool chain_controller::_push_block(const signed_block& new_block)
*/
processed_transaction chain_controller::push_transaction(const signed_transaction& trx, uint32_t skip)
{ try {
return with_skip_flags(skip, [&]() {
return with_skip_flags(skip|pushed_transaction, [&]() {
return _db.with_write_lock([&]() {
return _push_transaction(trx);
});
Expand Down Expand Up @@ -897,8 +897,10 @@ void chain_controller::process_message(const transaction& trx, account_name code
apply_context* parent_context, int depth,
const fc::time_point& start_time ) {
const blockchain_configuration& chain_configuration = get_global_properties().configuration;
EOS_ASSERT((fc::time_point::now() - start_time).count() < chain_configuration.max_trx_runtime, checktime_exceeded,
"Transaction message exceeded maximum total transaction time of ${limit}ms", ("limit", chain_configuration.max_trx_runtime));
if( is_producing() ) {
EOS_ASSERT((fc::time_point::now() - start_time).count() < chain_configuration.max_trx_runtime, checktime_exceeded,
"Transaction message exceeded maximum total transaction time of ${limit}ms", ("limit", chain_configuration.max_trx_runtime));
}
EOS_ASSERT(depth < chain_configuration.in_depth_limit, msg_resource_exhausted,
"Message processing exceeded maximum inline recursion depth of ${limit}", ("limit", chain_configuration.in_depth_limit));

Expand Down Expand Up @@ -971,8 +973,7 @@ void chain_controller::apply_message(apply_context& context)
: _skip_flags & created_block
? _create_block_txn_execution_time
: _txn_execution_time;
const bool is_received_block = _skip_flags & received_block;
wasm_interface::get().apply(context, execution_time, is_received_block);
wasm_interface::get().apply(context, execution_time, is_producing() );
}

} FC_CAPTURE_AND_RETHROW((context.msg)) }
Expand Down
3 changes: 2 additions & 1 deletion libraries/chain/include/eos/chain/chain_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ namespace eosio { namespace chain {
const chainbase::database& get_database() const { return _db; }
chainbase::database& get_mutable_database() { return _db; }

bool should_check_scope()const { return !(_skip_flags&skip_scope_check); }
bool should_check_scope()const { return !(_skip_flags&skip_scope_check); }
bool is_producing()const { return _skip_flags & (received_block | pushed_transaction); }


const deque<signed_transaction>& pending()const { return _pending_transactions; }
Expand Down

0 comments on commit cf60c2e

Please sign in to comment.