Skip to content

Commit

Permalink
GH-1941 Avoid copy
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Dec 21, 2023
1 parent 1258af4 commit 26c61be
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block() {
_pending_block_mode = pending_block_mode::producing;

// Not our turn
const auto scheduled_producer = chain.active_producers().get_scheduled_producer(block_time);
const auto& scheduled_producer = chain.active_producers().get_scheduled_producer(block_time);

const auto current_watermark = _producer_watermarks.get_watermark(scheduled_producer.producer_name);

Expand Down Expand Up @@ -1947,11 +1947,12 @@ producer_plugin_impl::start_block_result producer_plugin_impl::start_block() {
LOG_AND_DROP();

if (chain.is_building_block()) {
auto pending_block_signing_authority = chain.pending_block_signing_authority();
const auto& pending_block_signing_authority = chain.pending_block_signing_authority();
const auto& scheduled_producer_authority = chain.active_producers().get_scheduled_producer(block_time);

if (in_producing_mode() && pending_block_signing_authority != scheduled_producer.authority) {
if (in_producing_mode() && pending_block_signing_authority != scheduled_producer_authority.authority) {
elog("Unexpected block signing authority, reverting to speculative mode! [expected: \"${expected}\", actual: \"${actual\"",
("expected", scheduled_producer.authority)("actual", pending_block_signing_authority));
("expected", scheduled_producer_authority.authority)("actual", pending_block_signing_authority));
_pending_block_mode = pending_block_mode::speculating;
}

Expand Down

0 comments on commit 26c61be

Please sign in to comment.