mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Improve comments.
Fix a typo in previous commit.
This commit is contained in:
@@ -59,7 +59,8 @@ void TransactionAcquire::trigger(Peer::ref peer, bool timer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<SHAMapNode> nodeIDs; std::vector<uint256> nodeHashes;
|
std::vector<SHAMapNode> nodeIDs;
|
||||||
|
std::vector<uint256> nodeHashes;
|
||||||
ConsensusTransSetSF sf;
|
ConsensusTransSetSF sf;
|
||||||
mMap->getMissingNodes(nodeIDs, nodeHashes, 256, &sf);
|
mMap->getMissingNodes(nodeIDs, nodeHashes, 256, &sf);
|
||||||
if (nodeIDs.empty())
|
if (nodeIDs.empty())
|
||||||
@@ -68,6 +69,8 @@ void TransactionAcquire::trigger(Peer::ref peer, bool timer)
|
|||||||
mComplete = true;
|
mComplete = true;
|
||||||
else
|
else
|
||||||
mFailed = true;
|
mFailed = true;
|
||||||
|
done();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -77,12 +80,9 @@ void TransactionAcquire::trigger(Peer::ref peer, bool timer)
|
|||||||
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
for (std::vector<SHAMapNode>::iterator it = nodeIDs.begin(); it != nodeIDs.end(); ++it)
|
||||||
*(tmGL.add_nodeids()) = it->getRawString();
|
*(tmGL.add_nodeids()) = it->getRawString();
|
||||||
sendRequest(tmGL, peer);
|
sendRequest(tmGL, peer);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mComplete || mFailed)
|
if (timer)
|
||||||
done();
|
|
||||||
else if (timer)
|
|
||||||
resetTimer();
|
resetTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@ bool TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LCTransaction::setVote(const uint160& peer, bool votesYes)
|
void LCTransaction::setVote(const uint160& peer, bool votesYes)
|
||||||
{
|
{ // Tracke a peer's yes/no vote on a particular disputed transaction
|
||||||
std::pair<boost::unordered_map<uint160, bool>::iterator, bool> res =
|
std::pair<boost::unordered_map<uint160, bool>::iterator, bool> res =
|
||||||
mVotes.insert(std::make_pair<uint160, bool>(peer, votesYes));
|
mVotes.insert(std::make_pair<uint160, bool>(peer, votesYes));
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void LCTransaction::setVote(const uint160& peer, bool votesYes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LCTransaction::unVote(const uint160& peer)
|
void LCTransaction::unVote(const uint160& peer)
|
||||||
{
|
{ // Remove a peer's vote on this disputed transasction
|
||||||
boost::unordered_map<uint160, bool>::iterator it = mVotes.find(peer);
|
boost::unordered_map<uint160, bool>::iterator it = mVotes.find(peer);
|
||||||
if (it != mVotes.end())
|
if (it != mVotes.end())
|
||||||
{
|
{
|
||||||
@@ -175,7 +175,7 @@ void LCTransaction::unVote(const uint160& peer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool LCTransaction::updatePosition(int percentTime, bool proposing)
|
bool LCTransaction::updatePosition(int percentTime, bool proposing)
|
||||||
{ // this many seconds after close, should our position change
|
{
|
||||||
if (mOurPosition && (mNays == 0))
|
if (mOurPosition && (mNays == 0))
|
||||||
return false;
|
return false;
|
||||||
if (!mOurPosition && (mYays == 0))
|
if (!mOurPosition && (mYays == 0))
|
||||||
@@ -247,18 +247,17 @@ void LedgerConsensus::checkLCL()
|
|||||||
uint256 netLgr = mPrevLedgerHash;
|
uint256 netLgr = mPrevLedgerHash;
|
||||||
int netLgrCount = 0;
|
int netLgrCount = 0;
|
||||||
|
|
||||||
uint256 favoredLedger = (mState == PRE_CLOSE) ? uint256() : mPrevLedgerHash; // Don't get stuck one ledger behind
|
uint256 favoredLedger = (mState == lcsPRE_CLOSE) ? uint256() : mPrevLedgerHash; // Don't get stuck one ledger behind
|
||||||
boost::unordered_map<uint256, int> vals = theApp->getValidations().getCurrentValidations(mPrevLedgerHash);
|
boost::unordered_map<uint256, int> vals =
|
||||||
|
theApp->getValidations().getCurrentValidations(favoredLedger);
|
||||||
|
|
||||||
typedef std::pair<const uint256, int> u256_int_pair;
|
typedef std::pair<const uint256, int> u256_int_pair;
|
||||||
BOOST_FOREACH(u256_int_pair& it, vals)
|
BOOST_FOREACH(u256_int_pair& it, vals)
|
||||||
{
|
|
||||||
if (it.second > netLgrCount)
|
if (it.second > netLgrCount)
|
||||||
{
|
{
|
||||||
netLgr = it.first;
|
netLgr = it.first;
|
||||||
netLgrCount = it.second;
|
netLgrCount = it.second;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (netLgr != mPrevLedgerHash)
|
if (netLgr != mPrevLedgerHash)
|
||||||
{ // LCL change
|
{ // LCL change
|
||||||
@@ -301,8 +300,10 @@ void LedgerConsensus::handleLCL(const uint256& lclHash)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log(lsWARNING) << "Need consensus ledger " << mPrevLedgerHash;
|
Log(lsWARNING) << "Need consensus ledger " << mPrevLedgerHash;
|
||||||
|
|
||||||
mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(mPrevLedgerHash);
|
mAcquiringLedger = theApp->getMasterLedgerAcquire().findCreate(mPrevLedgerHash);
|
||||||
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
|
std::vector<Peer::pointer> peerList = theApp->getConnectionPool().getPeerVector();
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
BOOST_FOREACH(Peer::ref peer, peerList)
|
BOOST_FOREACH(Peer::ref peer, peerList)
|
||||||
{
|
{
|
||||||
@@ -312,11 +313,13 @@ void LedgerConsensus::handleLCL(const uint256& lclHash)
|
|||||||
mAcquiringLedger->peerHas(peer);
|
mAcquiringLedger->peerHas(peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
BOOST_FOREACH(Peer::ref peer, peerList)
|
BOOST_FOREACH(Peer::ref peer, peerList)
|
||||||
mAcquiringLedger->peerHas(peer);
|
mAcquiringLedger->peerHas(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHaveCorrectLCL && mProposing && mOurPosition)
|
if (mHaveCorrectLCL && mProposing && mOurPosition)
|
||||||
{
|
{
|
||||||
Log(lsINFO) << "Bowing out of consensus";
|
Log(lsINFO) << "Bowing out of consensus";
|
||||||
|
|||||||
Reference in New Issue
Block a user