From 8a71b861b1e01aa0ea2216c964b609ec12158a8b Mon Sep 17 00:00:00 2001 From: Anton Perkov Date: Tue, 27 Mar 2018 09:31:11 -0400 Subject: [PATCH] check max number of deferred transactions fix #1735 --- libraries/chain/apply_context.cpp | 3 ++- libraries/chain/include/eosio/chain/apply_context.hpp | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/chain/apply_context.cpp b/libraries/chain/apply_context.cpp index 648ad2859..e2fabf1e1 100644 --- a/libraries/chain/apply_context.cpp +++ b/libraries/chain/apply_context.cpp @@ -218,7 +218,7 @@ void apply_context::execute_deferred( deferred_transaction&& trx ) { FC_ASSERT( !trx.actions.empty(), "transaction must have at least one action"); const auto& gpo = controller.get_global_properties(); - FC_ASSERT( results.deferred_transaction_requests.size() < gpo.configuration.max_generated_transaction_count ); + FC_ASSERT( results.deferred_transactions_count < gpo.configuration.max_generated_transaction_count ); // privileged accounts can do anything, no need to check auth if( !privileged ) { @@ -240,6 +240,7 @@ void apply_context::execute_deferred( deferred_transaction&& trx ) { trx.set_reference_block(controller.head_block_id()); results.deferred_transaction_requests.push_back(move(trx)); + results.deferred_transactions_count++; } FC_CAPTURE_AND_RETHROW((trx)); } diff --git a/libraries/chain/include/eosio/chain/apply_context.hpp b/libraries/chain/include/eosio/chain/apply_context.hpp index 580d06868..5baf8b357 100644 --- a/libraries/chain/include/eosio/chain/apply_context.hpp +++ b/libraries/chain/include/eosio/chain/apply_context.hpp @@ -524,6 +524,7 @@ class apply_context { struct apply_results { vector applied_actions; vector> deferred_transaction_requests; + size_t deferred_transactions_count = 0; }; apply_results results; @@ -575,6 +576,7 @@ class apply_context { void append_results(apply_results &&other) { fc::move_append(results.applied_actions, std::move(other.applied_actions)); fc::move_append(results.deferred_transaction_requests, std::move(other.deferred_transaction_requests)); + results.deferred_transactions_count += other.deferred_transactions_count; } void exec_one(); @@ -755,4 +757,4 @@ using apply_handler = std::function; } } // namespace eosio::chain -FC_REFLECT(eosio::chain::apply_context::apply_results, (applied_actions)(deferred_transaction_requests)) +FC_REFLECT(eosio::chain::apply_context::apply_results, (applied_actions)(deferred_transaction_requests)(deferred_transactions_count)) -- GitLab