diff --git a/src/SHAMap.cpp b/src/SHAMap.cpp index 97580186e..efd97e266 100644 --- a/src/SHAMap.cpp +++ b/src/SHAMap.cpp @@ -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); } } diff --git a/src/SHAMap.h b/src/SHAMap.h index 11c34a74d..72a4f23c3 100644 --- a/src/SHAMap.h +++ b/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; } diff --git a/src/SHAMapDiff.cpp b/src/SHAMapDiff.cpp index fa1ae6a64..d0e78e8f9 100644 --- a/src/SHAMapDiff.cpp +++ b/src/SHAMapDiff.cpp @@ -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())