mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Cleanups.
This commit is contained in:
@@ -84,8 +84,8 @@ void TransactionAcquire::trigger(Peer::ref peer, bool timer)
|
||||
ripple::TMGetLedger tmGL;
|
||||
tmGL.set_ledgerhash(mHash.begin(), mHash.size());
|
||||
tmGL.set_itype(ripple::liTS_CANDIDATE);
|
||||
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
||||
*(tmGL.add_nodeids()) = it->getRawString();
|
||||
BOOST_FOREACH(SHAMapNode& it, nodeIDs)
|
||||
*(tmGL.add_nodeids()) = it.getRawString();
|
||||
sendRequest(tmGL, peer);
|
||||
}
|
||||
}
|
||||
@@ -410,17 +410,19 @@ void LedgerConsensus::createDisputes(SHAMap::ref m1, SHAMap::ref m2)
|
||||
{
|
||||
SHAMap::SHAMapDiff differences;
|
||||
m1->compare(m2, differences, 16384);
|
||||
for (SHAMap::SHAMapDiff::iterator pos = differences.begin(), end = differences.end(); pos != end; ++pos)
|
||||
|
||||
typedef std::pair<const uint256, SHAMap::SHAMapDiffItem> u256_diff_pair;
|
||||
BOOST_FOREACH (u256_diff_pair& pos, differences)
|
||||
{ // create disputed transactions (from the ledger that has them)
|
||||
if (pos->second.first)
|
||||
if (pos.second.first)
|
||||
{ // transaction is in first map
|
||||
assert(!pos->second.second);
|
||||
addDisputedTransaction(pos->first, pos->second.first->peekData());
|
||||
assert(!pos.second.second);
|
||||
addDisputedTransaction(pos.first, pos.second.first->peekData());
|
||||
}
|
||||
else if (pos->second.second)
|
||||
else if (pos.second.second)
|
||||
{ // transaction is in second map
|
||||
assert(!pos->second.first);
|
||||
addDisputedTransaction(pos->first, pos->second.second->peekData());
|
||||
assert(!pos.second.first);
|
||||
addDisputedTransaction(pos.first, pos.second.second->peekData());
|
||||
}
|
||||
else // No other disagreement over a transaction should be possible
|
||||
assert(false);
|
||||
|
||||
@@ -678,7 +678,7 @@ bool NetworkOPs::haveConsensusObject()
|
||||
bool ledgerChange = checkLastClosedLedger(peerList, networkClosed);
|
||||
if (!ledgerChange)
|
||||
{
|
||||
cLog(lsWARNING) << "Beginning consensus due to peer action";
|
||||
cLog(lsINFO) << "Beginning consensus due to peer action";
|
||||
beginConsensus(networkClosed, mLedgerMaster->getCurrentLedger());
|
||||
}
|
||||
return mConsensus;
|
||||
|
||||
@@ -688,9 +688,7 @@ void Peer::recvHello(ripple::TMHello& packet)
|
||||
|
||||
void Peer::recvTransaction(ripple::TMTransaction& packet)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Got transaction from peer" << std::endl;
|
||||
#endif
|
||||
cLog(lsDEBUG) << "Got transaction from peer";
|
||||
|
||||
Transaction::pointer tx;
|
||||
#ifndef TRUST_NETWORK
|
||||
|
||||
@@ -2612,9 +2612,9 @@ Json::Value RPCHandler::doLogLevel(const Json::Value& params)
|
||||
ret["base"] = Log::severityToString(Log::getMinSeverity());
|
||||
|
||||
std::vector< std::pair<std::string, std::string> > logTable = LogPartition::getSeverities();
|
||||
for (std::vector< std::pair<std::string, std::string> >::iterator it = logTable.begin();
|
||||
it != logTable.end(); ++it)
|
||||
ret[it->first] = it->second;
|
||||
typedef std::pair<std::string, std::string> stringPair;
|
||||
BOOST_FOREACH(const stringPair& it, logTable)
|
||||
ret[it.first] = it.second;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,8 @@ public:
|
||||
typedef boost::shared_ptr<SHAMap> pointer;
|
||||
typedef const boost::shared_ptr<SHAMap>& ref;
|
||||
|
||||
typedef std::map<uint256, std::pair<SHAMapItem::pointer, SHAMapItem::pointer> > SHAMapDiff;
|
||||
typedef std::pair<SHAMapItem::pointer, SHAMapItem::pointer> SHAMapDiffItem;
|
||||
typedef std::map<uint256, SHAMapDiffItem> SHAMapDiff;
|
||||
typedef boost::unordered_map<SHAMapNode, SHAMapTreeNode::pointer> SHADirtyMap;
|
||||
|
||||
private:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
@@ -200,9 +201,8 @@ void SNTPClient::init(const std::vector<std::string>& servers)
|
||||
Log(lsINFO) << "SNTP: no server specified";
|
||||
return;
|
||||
}
|
||||
do
|
||||
addServer(*it++);
|
||||
while (it != servers.end());
|
||||
BOOST_FOREACH(const std::string& it, servers)
|
||||
addServer(it);
|
||||
queryAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +77,9 @@ std::vector<RippleAddress> SerializedTransaction::getAffectedAccounts() const
|
||||
{
|
||||
bool found = false;
|
||||
RippleAddress na = sa->getValueNCA();
|
||||
for (std::vector<RippleAddress>::iterator it = accounts.begin(), end = accounts.end();
|
||||
it != end; ++it)
|
||||
BOOST_FOREACH(const RippleAddress& it, accounts)
|
||||
{
|
||||
if (*it == na)
|
||||
if (it == na)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "key.h"
|
||||
#include "Log.h"
|
||||
@@ -376,11 +377,13 @@ int Serializer::addTaggedList(const std::list<TaggedListItem>& list)
|
||||
if (size > 255) return -1;
|
||||
int ret = add8(size);
|
||||
if (size != 0)
|
||||
for (std::list<TaggedListItem>::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
{
|
||||
add8(it->first);
|
||||
addVL(it->second);
|
||||
add8(it.first);
|
||||
addVL(it.second);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -390,11 +393,13 @@ int Serializer::addTaggedList(const std::vector<TaggedListItem>& list)
|
||||
if (size > 255) return -1;
|
||||
int ret = add8(size);
|
||||
if (size != 0)
|
||||
for (std::vector<TaggedListItem>::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
{
|
||||
add8(it->first);
|
||||
addVL(it->second);
|
||||
add8(it.first);
|
||||
addVL(it.second);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -404,8 +409,10 @@ int Serializer::getTaggedListLength(const std::list<TaggedListItem>& list)
|
||||
if (size > 255) return -1;
|
||||
int ret = 1;
|
||||
if (size != 0)
|
||||
for (std::list<TaggedListItem>::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
ret += 1 + it->second.size() + Serializer::encodeLengthLength(it->second.size());
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
ret += 1 + it.second.size() + Serializer::encodeLengthLength(it.second.size());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -415,8 +422,10 @@ int Serializer::getTaggedListLength(const std::vector<TaggedListItem>& list)
|
||||
if (size > 255) return -1;
|
||||
int ret = 1;
|
||||
if (size != 0)
|
||||
for (std::vector<TaggedListItem>::const_iterator it = list.begin(); it != list.end(); ++it)
|
||||
ret += 1 + it->second.size() + Serializer::encodeLengthLength(it->second.size());
|
||||
{
|
||||
BOOST_FOREACH(const TaggedListItem& it, list)
|
||||
ret += 1 + it.second.size() + Serializer::encodeLengthLength(it.second.size());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ bool Transaction::convertToTransactions(uint32 firstLedgerSeq, uint32 secondLedg
|
||||
std::map<uint256, std::pair<Transaction::pointer, Transaction::pointer> >& outMap)
|
||||
{ // convert a straight SHAMap payload difference to a transaction difference table
|
||||
// return value: true=ledgers are valid, false=a ledger is invalid
|
||||
std::map<uint256, std::pair<SHAMapItem::pointer, SHAMapItem::pointer> >::const_iterator it;
|
||||
SHAMap::SHAMapDiff::const_iterator it;
|
||||
for(it = inMap.begin(); it != inMap.end(); ++it)
|
||||
{
|
||||
const uint256& id = it->first;
|
||||
|
||||
Reference in New Issue
Block a user