mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
At level 64, only leaves are allowed
This commit is contained in:
committed by
Vinnie Falco
parent
52f45669d1
commit
0075f36bbc
@@ -539,7 +539,11 @@ void InboundLedger::trigger (Peer::ptr const& peer)
|
||||
{
|
||||
assert (mLedger);
|
||||
|
||||
if (mLedger->peekAccountStateMap ()->getHash ().isZero ())
|
||||
if (!mLedger->peekAccountStateMap ()->isValid ())
|
||||
{
|
||||
mFailed = true;
|
||||
}
|
||||
else if (mLedger->peekAccountStateMap ()->getHash ().isZero ())
|
||||
{
|
||||
// we need the root node
|
||||
tmGL.set_itype (protocol::liAS_NODE);
|
||||
@@ -614,7 +618,11 @@ void InboundLedger::trigger (Peer::ptr const& peer)
|
||||
{
|
||||
assert (mLedger);
|
||||
|
||||
if (mLedger->peekTransactionMap ()->getHash ().isZero ())
|
||||
if (!mLedger->peekTransactionMap ()->isValid ())
|
||||
{
|
||||
mFailed = true;
|
||||
}
|
||||
else if (mLedger->peekTransactionMap ()->getHash ().isZero ())
|
||||
{
|
||||
// we need the root node
|
||||
tmGL.set_itype (protocol::liTX_NODE);
|
||||
|
||||
@@ -472,6 +472,13 @@ SHAMapAddNode SHAMap::addKnownNode (const SHAMapNode& node, Blob const& rawNode,
|
||||
|
||||
canonicalize (iNode->getChildHash (branch), newNode);
|
||||
|
||||
if (!iNode->isInBounds ())
|
||||
{
|
||||
// Map is provably invalid
|
||||
mState = smsInvalid;
|
||||
return SHAMapAddNode::useful ();
|
||||
}
|
||||
|
||||
if (mTNByID.canonicalize(node, &newNode) && filter)
|
||||
{
|
||||
Serializer s;
|
||||
|
||||
@@ -99,6 +99,11 @@ public:
|
||||
{
|
||||
return mType == tnINNER;
|
||||
}
|
||||
bool isInBounds () const
|
||||
{
|
||||
// Nodes at depth 64 must be leaves
|
||||
return (!isInner() || (getDepth() < 64));
|
||||
}
|
||||
bool isValid () const
|
||||
{
|
||||
return mType != tnERROR;
|
||||
|
||||
@@ -163,6 +163,11 @@ void TransactionAcquire::trigger (Peer::ptr const& peer)
|
||||
* (tmGL.add_nodeids ()) = SHAMapNode ().getRawString ();
|
||||
sendRequest (tmGL, peer);
|
||||
}
|
||||
else if (!mMap->isValid ())
|
||||
{
|
||||
mFailed = true;
|
||||
done ();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<SHAMapNode> nodeIDs;
|
||||
|
||||
Reference in New Issue
Block a user