mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Put the missing node type in the SHAMapMissingNode exception.
This commit is contained in:
@@ -181,7 +181,7 @@ SHAMapTreeNode* SHAMap::walkToPointer(const uint256& id)
|
||||
if (nextHash.isZero()) return NULL;
|
||||
inNode = getNodePointer(inNode->getChildNodeID(branch), nextHash);
|
||||
if (!inNode)
|
||||
throw SHAMapMissingNode(inNode->getChildNodeID(branch), nextHash, id);
|
||||
throw SHAMapMissingNode(mType, inNode->getChildNodeID(branch), nextHash, id);
|
||||
}
|
||||
return (inNode->getTag() == id) ? inNode : NULL;
|
||||
}
|
||||
@@ -686,11 +686,11 @@ void SHAMapItem::dump()
|
||||
SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const uint256& hash)
|
||||
{
|
||||
if (!theApp->running())
|
||||
throw SHAMapMissingNode(id, hash);
|
||||
throw SHAMapMissingNode(mType, id, hash);
|
||||
|
||||
HashedObject::pointer obj(theApp->getHashedObjectStore().retrieve(hash));
|
||||
if (!obj)
|
||||
throw SHAMapMissingNode(id, hash);
|
||||
throw SHAMapMissingNode(mType, id, hash);
|
||||
assert(Serializer::getSHA512Half(obj->getData()) == hash);
|
||||
|
||||
try
|
||||
@@ -704,7 +704,7 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui
|
||||
catch (...)
|
||||
{
|
||||
cLog(lsWARNING) << "fetchNodeExternal gets an invalid node: " << hash;
|
||||
throw SHAMapMissingNode(id, hash);
|
||||
throw SHAMapMissingNode(mType, id, hash);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
src/SHAMap.h
11
src/SHAMap.h
@@ -246,17 +246,19 @@ public:
|
||||
class SHAMapMissingNode : public std::runtime_error
|
||||
{
|
||||
protected:
|
||||
SHAMapType mType;
|
||||
SHAMapNode mNodeID;
|
||||
uint256 mNodeHash;
|
||||
uint256 mTargetIndex;
|
||||
|
||||
public:
|
||||
SHAMapMissingNode(const SHAMapNode& nodeID, const uint256& nodeHash) :
|
||||
std::runtime_error(nodeID.getString()), mNodeID(nodeID), mNodeHash(nodeHash)
|
||||
SHAMapMissingNode(SHAMapType t, const SHAMapNode& nodeID, const uint256& nodeHash) :
|
||||
std::runtime_error(nodeID.getString()), mType(t), mNodeID(nodeID), mNodeHash(nodeHash)
|
||||
{ ; }
|
||||
|
||||
SHAMapMissingNode(const SHAMapNode& nodeID, const uint256& nodeHash, const uint256& targetIndex) :
|
||||
std::runtime_error(nodeID.getString()), mNodeID(nodeID), mNodeHash(nodeHash), mTargetIndex(targetIndex)
|
||||
SHAMapMissingNode(SHAMapType t, const SHAMapNode& nodeID, const uint256& nodeHash, const uint256& targetIndex) :
|
||||
std::runtime_error(nodeID.getString()), mType(t),
|
||||
mNodeID(nodeID), mNodeHash(nodeHash), mTargetIndex(targetIndex)
|
||||
{ ; }
|
||||
|
||||
virtual ~SHAMapMissingNode() throw()
|
||||
@@ -264,6 +266,7 @@ public:
|
||||
|
||||
void setTargetNode(const uint256& tn) { mTargetIndex = tn; }
|
||||
|
||||
SHAMapType getMapType() const { return mType; }
|
||||
const SHAMapNode& getNodeID() const { return mNodeID; }
|
||||
const uint256& getNodeHash() const { return mNodeHash; }
|
||||
const uint256& getTargetIndex() const { return mTargetIndex; }
|
||||
|
||||
@@ -120,7 +120,7 @@ bool SHAMap::compare(SHAMap::ref otherMap, SHAMapDiff& differences, int maxCount
|
||||
if (!ourNode || !otherNode)
|
||||
{
|
||||
assert(false);
|
||||
throw SHAMapMissingNode(dNode.mNodeID, uint256());
|
||||
throw SHAMapMissingNode(mType, dNode.mNodeID, uint256());
|
||||
}
|
||||
|
||||
if (ourNode->isLeaf() && otherNode->isLeaf())
|
||||
|
||||
Reference in New Issue
Block a user