Use validations.

This commit is contained in:
JoelKatz
2012-06-18 17:01:54 -07:00
parent 5bca46d084
commit e458a2e3c7
2 changed files with 17 additions and 3 deletions

View File

@@ -308,11 +308,18 @@ void NetworkOPs::checkState(const boost::system::error_code& result)
if (!!peerLedger)
{
// FIXME: If we have this ledger, don't count it if it's too far past its close time
bool isNew = ledgers.find(peerLedger) == ledgers.end();
ValidationCount& vc = ledgers[peerLedger];
if (isNew)
{
theApp->getValidations().getValidationCount(peerLedger,
vc.trustedValidations, vc.untrustedValidations);
Log(lsTRACE) << peerLedger.GetHex() << " has " << vc.trustedValidations <<
" trusted validations and " << vc.untrustedValidations << " untrusted";
}
if ((vc.nodesUsing == 0) || ((*it)->getNodePublic() > vc.highNode))
vc.highNode = (*it)->getNodePublic();
++vc.nodesUsing;
// WRITEME: Validations, trusted peers
}
}
}
@@ -533,8 +540,8 @@ void NetworkOPs::setMode(OperatingMode om)
if (mMode == om) return;
Log l((om < mMode) ? lsWARNING : lsINFO);
if (om == omDISCONNECTED) l << "STATE->Disonnected";
else if (om==omCONNECTED) l << "STATE->Connected";
else if (om==omTRACKING) l << "STATE->Tracking";
else if (om == omCONNECTED) l << "STATE->Connected";
else if (om == omTRACKING) l << "STATE->Tracking";
else l << "STATE->Full";
mMode = om;
}
@@ -562,4 +569,9 @@ std::vector< std::pair<uint32, uint256> >
return affectedAccounts;
}
bool NetworkOPs::recvValidation(SerializedValidation::pointer val)
{
return theApp->getValidations().addValidation(val);
}
// vim:ts=4

View File

@@ -5,6 +5,7 @@
#include "AccountState.h"
#include "RippleState.h"
#include "NicknameState.h"
#include "SerializedValidation.h"
// #include <boost/asio.hpp>
@@ -115,6 +116,7 @@ public:
const std::string& pubKey, const std::string& signature);
bool gotTXData(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);
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);