From c036188c3cb8fe3cc318d4e4258d056512fd2a1d Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 19 Aug 2012 21:01:36 -0700 Subject: [PATCH] Some more cleanups. --- src/Ledger.h | 6 ------ src/NetworkOPs.cpp | 8 ++++---- src/NetworkOPs.h | 8 ++++---- src/PubKeyCache.cpp | 12 ++++++------ src/PubKeyCache.h | 2 +- src/TransactionEngine.h | 4 ++-- 6 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/Ledger.h b/src/Ledger.h index 7f60fcbc8f..53b7980794 100644 --- a/src/Ledger.h +++ b/src/Ledger.h @@ -281,12 +281,6 @@ public: SLE::pointer getRippleState(const uint160& uiA, const uint160& uiB, const uint160& uCurrency) { return getRippleState(getRippleStateIndex(NewcoinAddress::createAccountID(uiA), NewcoinAddress::createAccountID(uiB), uCurrency)); } - // - // Misc - // - bool isCompatible(boost::shared_ptr other); -// bool signLedger(std::vector &signature, const LocalHanko &hanko); - void addJson(Json::Value&, int options); static bool unitTest(); diff --git a/src/NetworkOPs.cpp b/src/NetworkOPs.cpp index 4d3fd7aee2..75b12a813b 100644 --- a/src/NetworkOPs.cpp +++ b/src/NetworkOPs.cpp @@ -650,7 +650,7 @@ SHAMap::pointer NetworkOPs::getTXMap(const uint256& hash) return mConsensus->getTransactionTree(hash, false); } -bool NetworkOPs::gotTXData(boost::shared_ptr peer, const uint256& hash, +bool NetworkOPs::gotTXData(const boost::shared_ptr& peer, const uint256& hash, const std::list& nodeIDs, const std::list< std::vector >& nodeData) { if (!mConsensus) @@ -658,14 +658,14 @@ bool NetworkOPs::gotTXData(boost::shared_ptr peer, const uint256& hash, return mConsensus->peerGaveNodes(peer, hash, nodeIDs, nodeData); } -bool NetworkOPs::hasTXSet(boost::shared_ptr peer, const uint256& set, newcoin::TxSetStatus status) +bool NetworkOPs::hasTXSet(const boost::shared_ptr& peer, const uint256& set, newcoin::TxSetStatus status) { if (!mConsensus) return false; return mConsensus->peerHasSet(peer, set, status); } -void NetworkOPs::mapComplete(const uint256& hash, SHAMap::pointer map) +void NetworkOPs::mapComplete(const uint256& hash, const SHAMap::pointer& map) { if (mConsensus) mConsensus->mapComplete(hash, map, true); @@ -746,7 +746,7 @@ std::vector return accounts; } -bool NetworkOPs::recvValidation(SerializedValidation::pointer val) +bool NetworkOPs::recvValidation(const SerializedValidation::pointer& val) { Log(lsINFO) << "recvValidation " << val->getLedgerHash().GetHex(); return theApp->getValidations().addValidation(val); diff --git a/src/NetworkOPs.h b/src/NetworkOPs.h index 79dc6ae138..91ac722a05 100644 --- a/src/NetworkOPs.h +++ b/src/NetworkOPs.h @@ -161,12 +161,12 @@ public: // ledger proposal/close functions bool recvPropose(uint32 proposeSeq, const uint256& proposeHash, uint32 closeTime, const std::string& pubKey, const std::string& signature); - bool gotTXData(boost::shared_ptr peer, const uint256& hash, + bool gotTXData(const boost::shared_ptr& peer, const uint256& hash, const std::list& nodeIDs, const std::list< std::vector >& nodeData); - bool recvValidation(SerializedValidation::pointer val); + bool recvValidation(const SerializedValidation::pointer& val); SHAMap::pointer getTXMap(const uint256& hash); - bool hasTXSet(boost::shared_ptr peer, const uint256& set, newcoin::TxSetStatus status); - void mapComplete(const uint256& hash, SHAMap::pointer map); + bool hasTXSet(const boost::shared_ptr& peer, const uint256& set, newcoin::TxSetStatus status); + void mapComplete(const uint256& hash, const SHAMap::pointer& map); // network state machine void checkState(const boost::system::error_code& result); diff --git a/src/PubKeyCache.cpp b/src/PubKeyCache.cpp index f6a4096d38..503fefc3d1 100644 --- a/src/PubKeyCache.cpp +++ b/src/PubKeyCache.cpp @@ -42,7 +42,7 @@ CKey::pointer PubKeyCache::locate(const NewcoinAddress& id) return ckp; } -CKey::pointer PubKeyCache::store(const NewcoinAddress& id, CKey::pointer key) +CKey::pointer PubKeyCache::store(const NewcoinAddress& id, const CKey::pointer& key) { // stored if needed, returns cached copy (possibly the original) { boost::mutex::scoped_lock sl(mLock); @@ -51,14 +51,14 @@ CKey::pointer PubKeyCache::store(const NewcoinAddress& id, CKey::pointer key) return pit.first->second; } - std::vector pk=key->GetPubKey(); + std::vector pk = key->GetPubKey(); std::string encodedPK; theApp->getTxnDB()->getDB()->escape(&(pk.front()), pk.size(), encodedPK); - std::string sql="INSERT INTO PubKeys (ID,PubKey) VALUES ('"; - sql+=id.humanAccountID(); - sql+="',"; - sql+=encodedPK; + std::string sql = "INSERT INTO PubKeys (ID,PubKey) VALUES ('"; + sql += id.humanAccountID(); + sql += "',"; + sql += encodedPK; sql.append(");"); ScopedLock dbl(theApp->getTxnDB()->getDBLock()); diff --git a/src/PubKeyCache.h b/src/PubKeyCache.h index bf6995875c..69c19b2be6 100644 --- a/src/PubKeyCache.h +++ b/src/PubKeyCache.h @@ -18,7 +18,7 @@ public: PubKeyCache() { ; } CKey::pointer locate(const NewcoinAddress& id); - CKey::pointer store(const NewcoinAddress& id, CKey::pointer key); + CKey::pointer store(const NewcoinAddress& id, const CKey::pointer& key); void clear(); }; diff --git a/src/TransactionEngine.h b/src/TransactionEngine.h index 5df286d743..1960bde680 100644 --- a/src/TransactionEngine.h +++ b/src/TransactionEngine.h @@ -268,10 +268,10 @@ protected: public: TransactionEngine() { ; } - TransactionEngine(Ledger::pointer ledger) : mLedger(ledger) { ; } + TransactionEngine(const Ledger::pointer& ledger) : mLedger(ledger) { ; } Ledger::pointer getLedger() { return mLedger; } - void setLedger(Ledger::pointer ledger) { assert(ledger); mLedger = ledger; } + void setLedger(const Ledger::pointer& ledger) { assert(ledger); mLedger = ledger; } TransactionEngineResult applyTransaction(const SerializedTransaction&, TransactionEngineParams); };