Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
KEP-1539 - additional safety checks (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
paularchard authored and amastracci committed Jul 23, 2019
1 parent 30d17df commit ee4145a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pbft/pbft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1469,8 +1469,14 @@ pbft::build_newview(uint64_t new_view, const std::map<uuid_t,bzn_envelope>& view
auto env = this->wrap_message(pre_prepare);
if (pre_prepare.request_type() == pbft_request_type::PBFT_REQUEST_PAYLOAD)
{
auto config = this->configurations->get(old_view);
if (!config)
{
LOG(error) << "config not found for view " << old_view;
continue;
}
auto op = this->operation_manager->find_or_construct(old_view, pre_prepare.sequence()
, pre_prepare.request_hash(), this->configurations->get(old_view)->get_peers());
, pre_prepare.request_hash(), config->get_peers());
*(env.add_piggybacked_requests()) = op->get_request();
}
pre_prepares[pre_prepare.sequence()] = env;
Expand Down Expand Up @@ -1544,9 +1550,14 @@ pbft::save_all_requests(const pbft_msg& msg, const bzn_envelope& original_msg)

const uint64_t& pre_prep_view{pp_msg.view()};

auto config = this->configurations->get(pre_prep_view);
if (!config)
{
LOG(error) << "config not found for view " << pre_prep_view;
continue;
}
auto op = this->operation_manager->find_or_construct(
pre_prep_view, pp_msg.sequence(), pp_msg.request_hash(),
this->configurations->get(pre_prep_view)->get_peers());
pre_prep_view, pp_msg.sequence(), pp_msg.request_hash(), config->get_peers());

op->record_request(request_env);
}
Expand Down

0 comments on commit ee4145a

Please sign in to comment.