mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Cleanups.
This commit is contained in:
@@ -167,10 +167,9 @@ void InboundLedger::onTimer (bool progress, boost::recursive_mutex::scoped_lock&
|
||||
int pc = getPeerCount ();
|
||||
WriteLog (lsDEBUG, InboundLedger) << "No progress(" << pc << ") for ledger " << mHash;
|
||||
|
||||
trigger (Peer::pointer ());
|
||||
if (pc < 3)
|
||||
addPeers ();
|
||||
else
|
||||
trigger (Peer::pointer ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,10 +210,8 @@ void InboundLedger::addPeers ()
|
||||
|
||||
if (peer->hasLedger (getHash (), mSeq))
|
||||
{
|
||||
peerHas (peer);
|
||||
|
||||
if (++found == 3)
|
||||
break;
|
||||
if (peerHas (peer) && (++found == 3))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,8 +809,12 @@ Json::Value InboundLedger::getJson (int)
|
||||
ret["peers"] = static_cast<int>(mPeers.size());
|
||||
|
||||
ret["have_base"] = mHaveBase;
|
||||
ret["have_state"] = mHaveState;
|
||||
ret["have_transactions"] = mHaveTransactions;
|
||||
|
||||
if (mHaveBase)
|
||||
{
|
||||
ret["have_state"] = mHaveState;
|
||||
ret["have_transactions"] = mHaveTransactions;
|
||||
}
|
||||
|
||||
if (mAborted)
|
||||
ret["aborted"] = true;
|
||||
@@ -823,7 +824,7 @@ Json::Value InboundLedger::getJson (int)
|
||||
if (mHaveBase && !mHaveState)
|
||||
{
|
||||
Json::Value hv (Json::arrayValue);
|
||||
std::vector<uint256> v = mLedger->peekAccountStateMap ()->getNeededHashes (16, NULL);
|
||||
std::vector<uint256> v = mLedger->getNeededAccountStateHashes (16, NULL);
|
||||
BOOST_FOREACH (uint256 const & h, v)
|
||||
{
|
||||
hv.append (h.GetHex ());
|
||||
@@ -834,7 +835,7 @@ Json::Value InboundLedger::getJson (int)
|
||||
if (mHaveBase && !mHaveTransactions)
|
||||
{
|
||||
Json::Value hv (Json::arrayValue);
|
||||
std::vector<uint256> v = mLedger->peekTransactionMap ()->getNeededHashes (16, NULL);
|
||||
std::vector<uint256> v = mLedger->getNeededTransactionHashes (16, NULL);
|
||||
BOOST_FOREACH (uint256 const & h, v)
|
||||
{
|
||||
hv.append (h.GetHex ());
|
||||
|
||||
@@ -21,14 +21,15 @@ PeerSet::PeerSet (uint256 const& hash, int interval, bool txnData)
|
||||
assert ((mTimerInterval > 10) && (mTimerInterval < 30000));
|
||||
}
|
||||
|
||||
void PeerSet::peerHas (Peer::ref ptr)
|
||||
bool PeerSet::peerHas (Peer::ref ptr)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||
|
||||
if (!mPeers.insert (std::make_pair (ptr->getPeerId (), 0)).second)
|
||||
return;
|
||||
return false;
|
||||
|
||||
newPeer (ptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PeerSet::badPeer (Peer::ref ptr)
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
return mLastAction;
|
||||
}
|
||||
|
||||
void peerHas (Peer::ref);
|
||||
bool peerHas (Peer::ref);
|
||||
void badPeer (Peer::ref);
|
||||
void setTimer ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user