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

Commit

Permalink
KEP-573: merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
paularchard committed Oct 18, 2018
1 parent 84dd6d6 commit 9818705
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pbft/pbft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ pbft::handle_join(const pbft_msg& msg)

// TODO - validate new peer (signature?)

// see if we can add this peer into a newly forked configuration
pbft_configuration config = this->current_configuration().fork();
if (config.add_peer(peer))
// see if we can add this peer into a newly copied configuration
auto config = std::make_shared<pbft_configuration>(*(this->configurations.current()));
if (config->add_peer(peer))
{
if (!this->add_configuration(config))
if (!this->configurations.add(config))
{
assert(false);
}
Expand Down Expand Up @@ -795,12 +795,12 @@ pbft::current_peers() const
}

void
pbft::broadcast_new_configuration(const pbft_configuration& config, const pbft_request& req)
pbft::broadcast_new_configuration(pbft_configuration::shared_const_ptr config, const pbft_request& req)
{
const uint64_t request_seq = this->next_issued_sequence_number++;
auto op = this->find_operation(this->view, request_seq, req);
pbft_msg msg = this->common_message_setup(op, PBFT_MSG_NEW_CONFIG);
std::string conf_str = config.to_json().toStyledString();
std::string conf_str = config->to_json().toStyledString();
msg.set_config(conf_str);

this->broadcast(this->wrap_message(msg, "new_config"));
Expand Down
2 changes: 1 addition & 1 deletion pbft/pbft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ namespace bzn

std::shared_ptr<const std::vector<bzn::peer_address_t>> current_peers_ptr() const;
const std::vector<bzn::peer_address_t>& current_peers() const;
void broadcast_new_configuration(const pbft_configuration& config, const pbft_request& req);
void broadcast_new_configuration(pbft_configuration::shared_const_ptr config, const pbft_request& req);

// Using 1 as first value here to distinguish from default value of 0 in protobuf
uint64_t view = 1;
Expand Down

0 comments on commit 9818705

Please sign in to comment.