Skip to content

Commit

Permalink
GH-239 Use next block time for block time on speculative nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Nov 15, 2024
1 parent 913e094 commit 5eae8fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1963,8 +1963,10 @@ producer_plugin::get_unapplied_transactions_result producer_plugin::get_unapplie

block_timestamp_type producer_plugin_impl::calculate_pending_block_time() const {
const chain::controller& chain = chain_plug->chain();
const fc::time_point now = fc::time_point::now();
const fc::time_point base = std::max<fc::time_point>(now, chain.head().block_time());
// on speculative nodes, always use next block time. On producers, honor current clock time
const fc::time_point base = _producers.empty()
? chain.head().block_time()
: std::max<fc::time_point>(fc::time_point::now(), chain.head().block_time());
return block_timestamp_type(base).next();
}

Expand Down

0 comments on commit 5eae8fe

Please sign in to comment.