diff --git a/libraries/chain/block_schedule.cpp b/libraries/chain/block_schedule.cpp index 40acdb75c55a9bbc9a6e4f2f00aee8aa7fca6ed1..447eb69bc5a02bb78995c317a9868d2c307688f0 100644 --- a/libraries/chain/block_schedule.cpp +++ b/libraries/chain/block_schedule.cpp @@ -289,4 +289,23 @@ block_schedule block_schedule::by_cycling_conflicts( return from_entries(schedule); } +block_schedule block_schedule::in_single_thread( + const vector& transactions, + const global_property_object& properties + ) +{ + auto skipper = make_skipper(properties); + thread_schedule thread; + thread.transactions.reserve(transactions.size()); + for(const auto& t: transactions) { + if (skipper.should_skip(t)) { + break; + } + + thread.transactions.push_back(t); + } + + return block_schedule { { { thread } } }; +} + } /* namespace chain */ } /* namespace eos */ diff --git a/libraries/chain/include/eos/chain/block_schedule.hpp b/libraries/chain/include/eos/chain/block_schedule.hpp index 983e7b6989b5d2c9f6368e64f5dd904107ed4dba..fe25f5e7c8ccdf5917b88334d68132106158c404 100644 --- a/libraries/chain/include/eos/chain/block_schedule.hpp +++ b/libraries/chain/include/eos/chain/block_schedule.hpp @@ -60,6 +60,13 @@ namespace eos { namespace chain { * @return the block scheduler */ static block_schedule by_cycling_conflicts(const vector& transactions, const global_property_object& properties); + + /** + * A reference scheduler that puts all transactions in a single thread (FIFO) + * @return the block scheduler + */ + static block_schedule in_single_thread(const vector& transactions, const global_property_object& properties); + }; struct scope_extracting_visitor : public fc::visitor> { diff --git a/libraries/chain/include/eos/chain/chain_controller.hpp b/libraries/chain/include/eos/chain/chain_controller.hpp index 6e3a31ba797d40de0d8b4a03303910d35414e12b..c6b5162030adc87a86ec6d1d82e44e5b621c5bbc 100644 --- a/libraries/chain/include/eos/chain/chain_controller.hpp +++ b/libraries/chain/include/eos/chain/chain_controller.hpp @@ -164,7 +164,7 @@ namespace eos { namespace chain { fc::time_point_sec when, const AccountName& producer, const fc::ecc::private_key& block_signing_private_key, - block_schedule::factory scheduler = block_schedule::by_threading_conflicts, + block_schedule::factory scheduler = block_schedule::in_single_thread, uint32_t skip = skip_nothing ); signed_block _generate_block( diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index b6ded71b8929fc6e5c9e1d88cf6db4f0de0e979d..a328d2ea4bd62f740bb58fc47f21731c5aecd498 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -54,7 +54,7 @@ public: bool _production_enabled = false; uint32_t _required_producer_participation = 33 * config::Percent1; uint32_t _production_skip_flags = eos::chain::chain_controller::skip_nothing; - eos::chain::block_schedule::factory _production_scheduler = eos::chain::block_schedule::by_threading_conflicts; + eos::chain::block_schedule::factory _production_scheduler = eos::chain::block_schedule::in_single_thread; std::map _private_keys; std::set _producers; diff --git a/tests/common/database_fixture.cpp b/tests/common/database_fixture.cpp index bdd61c5e1ab16cba5eb216b1f4e0ee8677d071b8..e6b841388ad283590c6a50beab1e20a2bd88ef14 100644 --- a/tests/common/database_fixture.cpp +++ b/tests/common/database_fixture.cpp @@ -116,7 +116,7 @@ void testing_blockchain::produce_blocks(uint32_t count, uint32_t blocks_to_miss) auto slot = blocks_to_miss + 1; auto producer = get_producer(get_scheduled_producer(slot)); auto private_key = fixture.get_private_key(producer.signing_key); - generate_block(get_slot_time(slot), producer.owner, private_key, block_schedule::by_threading_conflicts, + generate_block(get_slot_time(slot), producer.owner, private_key, block_schedule::in_single_thread, skip_trx_sigs? chain_controller::skip_transaction_signatures : 0); } }