Skip to content

Commit

Permalink
[FOLD] Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bachase committed Jul 6, 2017
1 parent 58bf7a5 commit 2f33f2e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/ripple/app/consensus/RCLConsensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ RCLConsensus::Adaptor::doAccept(
JLOG(j_.info()) << "CNF buildLCL " << newLCLHash;

// See if we can accept a ledger as fully-validated
ledgerMaster_.consensusBuilt(sharedLCL.ledger_, consensusJson);
ledgerMaster_.consensusBuilt(sharedLCL.ledger_, std::move(consensusJson));

//-------------------------------------------------------------------------
{
Expand Down
2 changes: 1 addition & 1 deletion src/ripple/app/misc/NetworkOPs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2126,7 +2126,7 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)

if (admin)
{
if (app_.getValidationPublicKey().size ())
if (!app_.getValidationPublicKey().empty())
{
info[jss::pubkey_validator] = toBase58 (
TokenType::TOKEN_NODE_PUBLIC,
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/consensus/Consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace ripple {
Mode mode);
// Called whenever consensus operating mode changes
void onModeChange(ConsensuMode before, ConsensusMode after);
void onModeChange(ConsensusMode before, ConsensusMode after);
// Called when ledger closes
Result onClose(Ledger const &, Ledger const & prev, Mode mode);
Expand Down Expand Up @@ -426,7 +426,7 @@ class Consensus
void
updateDisputes(NodeID_t const& node, TxSet_t const& other);

//Revoke our outstanding proposal, if any, and cease proposing
// Revoke our outstanding proposal, if any, and cease proposing
// until this round ends.
void
leaveConsensus();
Expand Down
5 changes: 3 additions & 2 deletions src/ripple/consensus/ConsensusTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ namespace ripple {
We enter the round proposing or observing. If we detect we are working
on the wrong prior ledger, we go to wrongLedger and attempt to acquire
the right one. Once we acquire the right one, we go to the switchedLedger
mode. If we again detect the wrong ledger before this round ends, we go
back to wrongLedger until we acquire the right one.
mode. It is possible we fall behind again and find there is a new better
ledger, moving back and forth between wrongLedger and switchLedger as
we attempt to catch up.
*/
enum class ConsensusMode {
//! We are normal participant in consensus and propose our position
Expand Down
4 changes: 2 additions & 2 deletions src/ripple/overlay/impl/PeerImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMTransaction> const& m)
flags |= SF_TRUSTED;
}

if (! app_.getValidationPublicKey().size())
if (app_.getValidationPublicKey().empty())
{
// For now, be paranoid and have each validator
// check each transaction, regardless of source
Expand Down Expand Up @@ -1256,7 +1256,7 @@ PeerImp::onMessage (std::shared_ptr <protocol::TMProposeSet> const& m)
return;
}

if (app_.getValidationPublicKey().size() &&
if (!app_.getValidationPublicKey().empty() &&
publicKey == app_.getValidationPublicKey())
{
JLOG(p_journal_.trace()) << "Proposal: self";
Expand Down
6 changes: 6 additions & 0 deletions src/ripple/protocol/PublicKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ class PublicKey
return size_;
}

bool
empty() const noexcept
{
return size_ == 0;
}

Slice
slice() const noexcept
{
Expand Down
4 changes: 0 additions & 4 deletions src/test/app/ValidatorKeys_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class ValidatorKeys_test : public beast::unit_test::suite
Config c;
ValidatorKeys k{c, j};
BEAST_EXPECT(k.publicKey.size() == 0);
BEAST_EXPECT(k.secretKey.size() == 0);
BEAST_EXPECT(k.manifest.empty());
BEAST_EXPECT(!k.configInvalid());

Expand All @@ -106,7 +105,6 @@ class ValidatorKeys_test : public beast::unit_test::suite
ValidatorKeys k{c, j};
BEAST_EXPECT(k.configInvalid());
BEAST_EXPECT(k.publicKey.size() == 0);
BEAST_EXPECT(k.secretKey.size() == 0);
BEAST_EXPECT(k.manifest.empty());
}

Expand All @@ -128,7 +126,6 @@ class ValidatorKeys_test : public beast::unit_test::suite
ValidatorKeys k{c, j};
BEAST_EXPECT(k.configInvalid());
BEAST_EXPECT(k.publicKey.size() == 0);
BEAST_EXPECT(k.secretKey.size() == 0);
BEAST_EXPECT(k.manifest.empty());
}

Expand All @@ -141,7 +138,6 @@ class ValidatorKeys_test : public beast::unit_test::suite

BEAST_EXPECT(k.configInvalid());
BEAST_EXPECT(k.publicKey.size() == 0);
BEAST_EXPECT(k.secretKey.size() == 0);
BEAST_EXPECT(k.manifest.empty());
}

Expand Down

0 comments on commit 2f33f2e

Please sign in to comment.