Code to determine how old a proposal is.

Low-level code to remove a peer from the consensus process.
This commit is contained in:
JoelKatz
2012-08-31 14:47:31 -07:00
parent 61de69e8d0
commit c3603c403d
4 changed files with 28 additions and 5 deletions

View File

@@ -161,6 +161,18 @@ void LCTransaction::setVote(const uint160& peer, bool votesYes)
}
}
void LCTransaction::unVote(const uint160& peer)
{
boost::unordered_map<uint160, bool>::iterator it = mVotes.find(peer);
if (it != mVotes.end())
{
if (it->second)
--mYays;
else
--mNays;
}
}
bool LCTransaction::updatePosition(int percentTime, bool proposing)
{ // this many seconds after close, should our position change
if (mOurPosition && (mNays == 0))
@@ -766,6 +778,13 @@ bool LedgerConsensus::peerPosition(const LedgerProposal::pointer& newPosition)
return true;
}
void LedgerConsensus::removePeer(const uint160& peerID)
{
mPeerPositions.erase(peerID);
BOOST_FOREACH(u256_lct_pair& it, mDisputes)
it.second->unVote(peerID);
}
bool LedgerConsensus::peerHasSet(const Peer::pointer& peer, const uint256& hashSet, newcoin::TxSetStatus status)
{
if (status != newcoin::tsHAVE) // Indirect requests are for future support