From 4155a6a45e566be600111144efc39a47cbdc2bc1 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 2 Jul 2013 13:31:43 -0700 Subject: [PATCH] If a tree consists only of a matching leaf, don't include that leaf in the fetch pack. --- src/cpp/ripple/ripple_SHAMapSync.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cpp/ripple/ripple_SHAMapSync.cpp b/src/cpp/ripple/ripple_SHAMapSync.cpp index d09b33c0f0..2e04babd82 100644 --- a/src/cpp/ripple/ripple_SHAMapSync.cpp +++ b/src/cpp/ripple/ripple_SHAMapSync.cpp @@ -432,6 +432,10 @@ bool SHAMap::deepCompare (SHAMap& other) bool SHAMap::hasInnerNode (const SHAMapNode& nodeID, uint256 const& nodeHash) { + boost::unordered_map::iterator it = mTNByID.find (nodeID); + if (it != mTNByID.end()) + return it->second->getNodeHash() == nodeHash; + SHAMapTreeNode* node = root.get (); while (node->isInner () && (node->getDepth () < nodeID.getDepth ())) @@ -466,7 +470,7 @@ bool SHAMap::hasLeafNode (uint256 const& tag, uint256 const& nodeHash) node = getNodePointer (node->getChildNodeID (branch), nextHash); } - return false; + return node->getNodeHash() == nodeHash; } static void addFPtoList (std::list& list, const uint256& hash, const Blob& blob)