From 1735fa9f297a64eca82bcdefb5b182b2e453f685 Mon Sep 17 00:00:00 2001 From: Yeon-Hyeong Yang Date: Mon, 8 Jun 2020 11:42:30 +0900 Subject: [PATCH] Fix saveRoot() to delete root node from recentDB --- nodedb.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nodedb.go b/nodedb.go index b28b6643d..852f427b3 100644 --- a/nodedb.go +++ b/nodedb.go @@ -767,9 +767,11 @@ func (ndb *nodeDB) saveRoot(hash []byte, version int64, flushToDisk bool) error key := ndb.rootKey(version) ndb.updateLatestVersion(version) - ndb.recentBatch.Set(key, hash) if flushToDisk { ndb.snapshotBatch.Set(key, hash) + ndb.recentBatch.Delete(key) + } else { + ndb.recentBatch.Set(key, hash) } return nil