Bugfixes.

This commit is contained in:
JoelKatz
2012-05-31 20:55:30 -07:00
parent a4abe5a9dc
commit 2ec46c0dbf
3 changed files with 21 additions and 12 deletions

View File

@@ -79,22 +79,30 @@ bool TransactionAcquire::takeNodes(const std::list<SHAMapNode>& nodeIDs,
return true;
if (mFailed)
return false;
std::list<SHAMapNode>::const_iterator nodeIDit = nodeIDs.begin();
std::list< std::vector<unsigned char> >::const_iterator nodeDatait = data.begin();
while (nodeIDit != nodeIDs.end())
try
{
if (nodeIDit->isRoot())
std::list<SHAMapNode>::const_iterator nodeIDit = nodeIDs.begin();
std::list< std::vector<unsigned char> >::const_iterator nodeDatait = data.begin();
while (nodeIDit != nodeIDs.end())
{
if (!mMap->addRootNode(getHash(), *nodeDatait))
if (nodeIDit->isRoot())
{
if (!mMap->addRootNode(getHash(), *nodeDatait))
return false;
}
else if (!mMap->addKnownNode(*nodeIDit, *nodeDatait))
return false;
++nodeIDit;
++nodeDatait;
}
else if (!mMap->addKnownNode(*nodeIDit, *nodeDatait))
return false;
++nodeIDit;
++nodeDatait;
trigger(peer);
return true;
}
catch (...)
{
Log(lsERROR) << "Peer sends us junky transaction node data";
return false;
}
trigger(peer);
return true;
}
void LCTransaction::setVote(const uint256& peer, bool votesYes)

View File

@@ -440,7 +440,7 @@ bool NetworkOPs::recvPropose(const uint256& prevLgr, uint32 proposeSeq, const ui
const std::string& pubKey, const std::string& signature)
{
if (mMode != omFULL) // FIXME: Should we relay?
Log(lsWARNING) << "Received proposal when not full" << mMode;
Log(lsWARNING) << "Received proposal when not full: " << mMode;
if (!mConsensus)
{
return true;

View File

@@ -196,6 +196,7 @@ SHAMapTreeNode::SHAMapTreeNode(const SHAMapNode& id, const std::vector<unsigned
int type = s.removeLastByte();
int len = s.getLength();
if ((type < 0) || (type > 3)) throw SHAMapException(InvalidNode);
assert(len >= 33);
if (type == 0)
{ // transaction