From 55e38c40f72a9e7e60c54fa4bf69cb840c602bf9 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 11 Oct 2012 07:01:03 -0700 Subject: [PATCH] Cleanups. --- src/SHAMap.cpp | 10 ++++++++++ src/SHAMap.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/src/SHAMap.cpp b/src/SHAMap.cpp index 3d6f70620..09877fa40 100644 --- a/src/SHAMap.cpp +++ b/src/SHAMap.cpp @@ -690,7 +690,10 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui HashedObject::pointer obj(theApp->getHashedObjectStore().retrieve(hash)); if (!obj) + { + Log(lsTRACE) << "fetchNodeExternal: missing " << hash; throw SHAMapMissingNode(mType, id, hash); + } assert(Serializer::getSHA512Half(obj->getData()) == hash); try @@ -708,6 +711,13 @@ SHAMapTreeNode::pointer SHAMap::fetchNodeExternal(const SHAMapNode& id, const ui } } +void SHAMap::fetchRoot(const uint256& hash) +{ + root = fetchNodeExternal(SHAMapNode(), hash); + root->makeInner(); + mTNByID[*root] = root; +} + void SHAMap::armDirty() { // begin saving dirty nodes ++mSeq; diff --git a/src/SHAMap.h b/src/SHAMap.h index 72a4f23c3..f144b5ca9 100644 --- a/src/SHAMap.h +++ b/src/SHAMap.h @@ -273,6 +273,8 @@ public: bool hasTargetIndex() const { return !mTargetIndex.isZero(); } }; +extern std::ostream& operator<<(std::ostream&, const SHAMapMissingNode&); + class SHAMap { public: @@ -330,6 +332,7 @@ public: ScopedLock Lock() const { return ScopedLock(mLock); } bool hasNode(const SHAMapNode& id); + void fetchRoot(const uint256& hash); // normal hash access functions bool hasItem(const uint256& id);