From 0183e4d1772e3d434cff55f91430c9ffb7ba53d4 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 52de73e43..2d41aa604 100644 --- a/src/cpp/ripple/ripple_SHAMapSync.cpp +++ b/src/cpp/ripple/ripple_SHAMapSync.cpp @@ -440,6 +440,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 ())) @@ -474,7 +478,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)