From 5eae8fefd4cd0f41184f7264efb51c8bb8eec477 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Fri, 15 Nov 2024 08:13:43 -0600 Subject: [PATCH] GH-239 Use next block time for block time on speculative nodes --- plugins/producer_plugin/producer_plugin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 4ceb1463a3..f575f9f8bb 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -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(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::now(), chain.head().block_time()); return block_timestamp_type(base).next(); }