Restrict Ledger.cpp to 80 columns.

This commit is contained in:
Tom Ritchford
2015-07-01 12:57:59 -04:00
committed by Vinnie Falco
parent 7ce871f3b2
commit c094772bc0

View File

@@ -396,7 +396,8 @@ void Ledger::setAccepted (
void Ledger::setAccepted () void Ledger::setAccepted ()
{ {
// used when we acquired the ledger // used when we acquired the ledger
// FIXME assert(closed() && (info_.closeTime != 0) && (mCloseResolution != 0)); // TODO: re-enable a test like the following:
// assert(closed() && (info_.closeTime != 0) && (mCloseResolution != 0));
if ((mCloseFlags & sLCF_NoConsensusTime) == 0) if ((mCloseFlags & sLCF_NoConsensusTime) == 0)
info_.closeTime = roundCloseTime( info_.closeTime = roundCloseTime(
info_.closeTime, mCloseResolution); info_.closeTime, mCloseResolution);
@@ -428,7 +429,9 @@ getTransaction (Ledger const& ledger,
return txn; return txn;
if (type == SHAMapTreeNode::tnTRANSACTION_NM) if (type == SHAMapTreeNode::tnTRANSACTION_NM)
{
txn = Transaction::sharedTransaction (item->peekData (), Validate::YES); txn = Transaction::sharedTransaction (item->peekData (), Validate::YES);
}
else if (type == SHAMapTreeNode::tnTRANSACTION_MD) else if (type == SHAMapTreeNode::tnTRANSACTION_MD)
{ {
auto sit = SerialIter{item->data(), item->size()}; auto sit = SerialIter{item->data(), item->size()};
@@ -441,7 +444,10 @@ getTransaction (Ledger const& ledger,
} }
if (txn->getStatus () == NEW) if (txn->getStatus () == NEW)
txn->setStatus (ledger.isClosed() ? COMMITTED : INCLUDED, ledger.getLedgerSeq()); {
txn->setStatus (
ledger.isClosed() ? COMMITTED : INCLUDED, ledger.getLedgerSeq());
}
cache.canonicalize (&txn); cache.canonicalize (&txn);
return txn; return txn;
@@ -621,8 +627,9 @@ bool Ledger::saveValidatedLedger (bool current)
if (!accts.empty ()) if (!accts.empty ())
{ {
std::string sql ("INSERT INTO AccountTransactions " std::string sql (
"(TransID, Account, LedgerSeq, TxnSeq) VALUES "); "INSERT INTO AccountTransactions "
"(TransID, Account, LedgerSeq, TxnSeq) VALUES ");
// Try to make an educated guess on how much space we'll need // Try to make an educated guess on how much space we'll need
// for our arguments. In argument order we have: // for our arguments. In argument order we have:
@@ -674,11 +681,12 @@ bool Ledger::saveValidatedLedger (bool current)
auto db (getApp().getLedgerDB ().checkoutDb ()); auto db (getApp().getLedgerDB ().checkoutDb ());
// TODO(tom): ARG! // TODO(tom): ARG!
*db << boost::str (addLedger % *db << boost::str (
to_string (getHash ()) % info_.seq % to_string (mParentHash) % addLedger %
beast::lexicalCastThrow <std::string> (mTotCoins) % info_.closeTime % to_string (getHash ()) % info_.seq % to_string (mParentHash) %
info_.parentCloseTime % mCloseResolution % mCloseFlags % beast::lexicalCastThrow <std::string> (mTotCoins) % info_.closeTime %
to_string (mAccountHash) % to_string (mTransHash)); info_.parentCloseTime % mCloseResolution % mCloseFlags %
to_string (mAccountHash) % to_string (mTransHash));
} }
// Clients can now trust the database for // Clients can now trust the database for