diff --git a/libdevcore/OverlayDB.cpp b/libdevcore/OverlayDB.cpp index 716d99c7631..433fa068665 100644 --- a/libdevcore/OverlayDB.cpp +++ b/libdevcore/OverlayDB.cpp @@ -140,7 +140,22 @@ bool OverlayDB::exists(h256 const& _h) const void OverlayDB::kill(h256 const& _h) { - StateCacheDB::kill(_h); + if (!StateCacheDB::kill(_h)) + { + if (m_db) + { + if (!m_db->exists(toSlice(_h))) + { + // No point node ref decreasing for EmptyTrie since we never bother incrementing it + // in the first place for empty storage tries. + if (_h != EmptyTrie) + cnote << "Decreasing DB node ref count below zero with no DB node. Probably " + "have a corrupt Trie." + << _h; + // TODO: for 1.1: ref-counted triedb. + } + } + } } }