From 294a13d653057b3ca96073a3063cb3262b70ec95 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sun, 11 May 2014 21:45:51 -0700 Subject: [PATCH] Put newly-created nodes in the treeNodeCache --- src/ripple_app/shamap/SHAMap.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ripple_app/shamap/SHAMap.cpp b/src/ripple_app/shamap/SHAMap.cpp index 87f9a0ae4..9612072bc 100644 --- a/src/ripple_app/shamap/SHAMap.cpp +++ b/src/ripple_app/shamap/SHAMap.cpp @@ -1133,15 +1133,17 @@ int SHAMap::flushDirty (DirtySet& set, int maxNodes, NodeObjectType t, std::uint #endif - getApp().getNodeStore ().store (t, seq, std::move (s.modData ()), nodeHash); - - if (getApp().running ()) + if (node->getSeq () != 0) { - // Put the canonical version into the SHAMap and the treeNodeCache - mTNByID.erase (*node); - fetchNodeExternal (*node, nodeHash); + // Node is not shareable + // Make and share a shareable copy + node = boost::make_shared (*node, 0); + canonicalize (node->getNodeHash(), node); + mTNByID.replace (*node, node); } + getApp().getNodeStore ().store (t, seq, std::move (s.modData ()), nodeHash); + if (flushed++ >= maxNodes) return flushed; }