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

Commit

Permalink
KEP-332 Fixes from Paul's review - removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
rnistuk committed Dec 6, 2018
1 parent 80a2132 commit 339fb1d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 63 deletions.
35 changes: 0 additions & 35 deletions pbft/pbft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,31 +1130,6 @@ pbft::get_sequences_and_request_hashes_from_proofs(
return true;
}

uint64_t
pbft::last_sequence_in_newview_preprepare_messages(const pbft_msg &newview)
{
uint64_t last_sequence{0};
for(int i{0}; i < newview.viewchange_messages_size(); ++i)
{
bzn_envelope viewchange_envelope = newview.viewchange_messages(i);
pbft_msg viewchange;
viewchange.ParseFromString(viewchange_envelope.pbft());

for(int j{0}; j < viewchange.prepared_proofs_size(); ++j)
{
prepared_proof proof = viewchange.prepared_proofs(j);
for(int k{0}; k < proof.prepare_size(); ++k)
{
bzn_envelope prepare = proof.prepare(k);
pbft_msg idfk;
idfk.ParseFromString(prepare.pbft());
last_sequence = std::max(last_sequence, idfk.sequence());
}
}
}
return last_sequence;
}

bool
pbft::is_valid_newview_message(const pbft_msg& theirs, const bzn_envelope& original_theirs) const
{
Expand Down Expand Up @@ -1644,16 +1619,6 @@ pbft::already_seen_request(const bzn_envelope& req, const request_hash_t& hash)
return false;
}

/*!
* Creates <VIEW-CHANGE v+1, n, C, P, i>_sigma_i
* @param new_view new view (v+1)
* @param base_sequence_number sequence of last stable checkpoint (n)
* @param stable_checkpoint_proof proof of checkpoint C
* @param prepared_operations set of messages after i was prepared
* @param i the uuid of the sender
*
* @return <VIEW-CHANGE v+1, n, C, P, i>_sigma_i
*/
pbft_msg
pbft::make_viewchange(
uint64_t new_view
Expand Down
1 change: 0 additions & 1 deletion pbft/pbft.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ namespace bzn
void fill_in_missing_pre_prepares(uint64_t max_checkpoint_sequence, uint64_t new_view, std::map<uint64_t, bzn_envelope>& pre_prepares) const;
bool is_peer(const bzn::uuid_t& peer) const;
bool get_sequences_and_request_hashes_from_proofs( const pbft_msg& viewchange_msg, std::set<std::pair<uint64_t, std::string>>& sequence_request_pairs) const;
static uint64_t last_sequence_in_newview_preprepare_messages(const pbft_msg &newview);

// Using 1 as first value here to distinguish from default value of 0 in protobuf
uint64_t view = 1;
Expand Down
27 changes: 0 additions & 27 deletions pbft/test/pbft_newview_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,31 +125,4 @@ namespace bzn
EXPECT_EQ(uuid, accepted_uuid);
}
}


TEST_F(pbft_newview_test, test_last_sequence_in_newview_prepared_proofs)
{
pbft_msg newview;

EXPECT_EQ(uint64_t(0U), pbft::last_sequence_in_newview_preprepare_messages(newview));

pbft_msg prepare;
prepare.set_sequence(100U);

bzn_envelope prepare_env;
prepare_env.set_pbft(prepare.SerializeAsString());

prepared_proof proof;
*(proof.add_prepare()) = prepare_env;

pbft_msg viewchange_message;
*(viewchange_message.add_prepared_proofs()) = proof;

bzn_envelope viewchange_env;
viewchange_env.set_pbft(viewchange_message.SerializeAsString());

*(newview.add_viewchange_messages()) = viewchange_env;

EXPECT_EQ(100U, pbft::last_sequence_in_newview_preprepare_messages(newview));
}
}

0 comments on commit 339fb1d

Please sign in to comment.