Cleanups:

* Use Throw instead of directly throwing an exception
This commit is contained in:
Nik Bougalis
2016-01-26 13:42:55 -08:00
parent f13668371e
commit 57d6ab091c
2 changed files with 11 additions and 12 deletions

View File

@@ -412,17 +412,15 @@ void LedgerConsensusImp::mapCompleteInternal (
// this will create disputed transactions
auto it2 = mAcquired.find (mOurPosition->getCurrentHash ());
if (it2 != mAcquired.end ())
{
if (it2 == mAcquired.end())
LogicError ("We cannot find our own position!");
assert ((it2->first == mOurPosition->getCurrentHash ())
&& it2->second);
mCompares.insert(hash);
// Our position is not the same as the acquired position
createDisputes (it2->second, map);
}
else
assert (false); // We don't have our own position?!
}
else if (!mOurPosition)
JLOG (j_.debug)
<< "Not creating disputes: no position yet.";
@@ -437,9 +435,10 @@ void LedgerConsensusImp::mapCompleteInternal (
// Adjust tracking for each peer that takes this position
std::vector<NodeID> peers;
auto const mapHash = map->getHash ().as_uint256();
for (auto& it : mPeerPositions)
{
if (it.second->getCurrentHash () == map->getHash ().as_uint256())
if (it.second->getCurrentHash () == mapHash)
peers.push_back (it.second->getPeerID ());
}

View File

@@ -448,7 +448,7 @@ void
SerialIter::skip (int length)
{
if (remain_ < length)
throw std::runtime_error(
Throw<std::runtime_error> (
"invalid SerialIter skip");
p_ += length;
used_ += length;