Skip to content

Commit

Permalink
GH-1837 Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 1, 2023
1 parent 87260ae commit c47a6a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin
}

void restart_speculative_block() {
// log message is used by Node.py verifyStartingBlockMessages in distributed-transactions-test.py test
fc_dlog(_log, "Restarting exhausted speculative block #${n}", ("n", chain_plug->chain().head_block_num() + 1));
// abort the pending block
abort_block();
Expand Down
3 changes: 3 additions & 0 deletions plugins/producer_plugin/test/test_block_timing_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,23 @@ BOOST_AUTO_TEST_CASE(test_calculate_block_deadline) {
auto seventh_block_time = eosio::chain::block_timestamp_type(production_round_1st_block_slot + 6);
fc::mock_time_traits::set_now(seventh_block_time.to_time_point() - fc::milliseconds(500));

// 7th block where cpu effort is 100ms less per block
BOOST_CHECK_EQUAL(calculate_producing_block_deadline(cpu_effort, seventh_block_time),
seventh_block_time.to_time_point() - fc::milliseconds(700));

// use previous deadline as now
fc::mock_time_traits::set_now(seventh_block_time.to_time_point() - fc::milliseconds(100));
auto eighth_block_time = eosio::chain::block_timestamp_type(production_round_1st_block_slot + 7);

// 8th block where cpu effort is 100ms less per block
BOOST_CHECK_EQUAL(calculate_producing_block_deadline(cpu_effort, eighth_block_time),
eighth_block_time.to_time_point() - fc::milliseconds(800));

// use previous deadline as now
fc::mock_time_traits::set_now(eighth_block_time.to_time_point() - fc::milliseconds(200));
auto ninth_block_time = eosio::chain::block_timestamp_type(production_round_1st_block_slot + 8);

// 9th block where cpu effort is 100ms less per block
BOOST_CHECK_EQUAL(calculate_producing_block_deadline(cpu_effort, ninth_block_time),
ninth_block_time.to_time_point() - fc::milliseconds(900));
}
Expand Down

0 comments on commit c47a6a5

Please sign in to comment.