Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Fix for nullptr deref when producers are waiting #5256

Merged
merged 1 commit into from
Aug 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,10 +831,13 @@ optional<fc::time_point> producer_plugin_impl::calculate_next_block_time(const a
auto current_watermark_itr = _producer_watermarks.find(producer_name);
if (current_watermark_itr != _producer_watermarks.end()) {
auto watermark = current_watermark_itr->second;
const auto& pbs = chain.pending_block_state();
if (watermark > pbs->block_num) {
auto block_num = chain.head_block_state()->block_num;
if (chain.pending_block_state()) {
++block_num;
}
if (watermark > block_num) {
// if I have a watermark then I need to wait until after that watermark
minimum_offset = watermark - pbs->block_num + 1;
minimum_offset = watermark - block_num + 1;
}
}

Expand Down