Some more cleanups.

This commit is contained in:
JoelKatz
2012-08-19 21:01:36 -07:00
parent 420ee91877
commit c036188c3c
6 changed files with 17 additions and 23 deletions

View File

@@ -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<Ledger> other);
// bool signLedger(std::vector<unsigned char> &signature, const LocalHanko &hanko);
void addJson(Json::Value&, int options);
static bool unitTest();

View File

@@ -650,7 +650,7 @@ SHAMap::pointer NetworkOPs::getTXMap(const uint256& hash)
return mConsensus->getTransactionTree(hash, false);
}
bool NetworkOPs::gotTXData(boost::shared_ptr<Peer> peer, const uint256& hash,
bool NetworkOPs::gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData)
{
if (!mConsensus)
@@ -658,14 +658,14 @@ bool NetworkOPs::gotTXData(boost::shared_ptr<Peer> peer, const uint256& hash,
return mConsensus->peerGaveNodes(peer, hash, nodeIDs, nodeData);
}
bool NetworkOPs::hasTXSet(boost::shared_ptr<Peer> peer, const uint256& set, newcoin::TxSetStatus status)
bool NetworkOPs::hasTXSet(const boost::shared_ptr<Peer>& 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<NewcoinAddress>
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);

View File

@@ -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> peer, const uint256& hash,
bool gotTXData(const boost::shared_ptr<Peer>& peer, const uint256& hash,
const std::list<SHAMapNode>& nodeIDs, const std::list< std::vector<unsigned char> >& nodeData);
bool recvValidation(SerializedValidation::pointer val);
bool recvValidation(const SerializedValidation::pointer& val);
SHAMap::pointer getTXMap(const uint256& hash);
bool hasTXSet(boost::shared_ptr<Peer> peer, const uint256& set, newcoin::TxSetStatus status);
void mapComplete(const uint256& hash, SHAMap::pointer map);
bool hasTXSet(const boost::shared_ptr<Peer>& 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);

View File

@@ -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<unsigned char> pk=key->GetPubKey();
std::vector<unsigned char> 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());

View File

@@ -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();
};

View File

@@ -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);
};