Skip to content

Commit

Permalink
Fix SaveNode() to delete node from recentDB
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbird committed Jun 4, 2020
1 parent 76a52fa commit 2e3d3bd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions nodedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,14 @@ func (ndb *nodeDB) SaveNode(node *Node, flushToDisk bool) {
panic(err)
}

if !node.saved {
node.saved = true
ndb.recentBatch.Set(ndb.nodeKey(node.hash), buf.Bytes())
}
if flushToDisk {
ndb.snapshotBatch.Set(ndb.nodeKey(node.hash), buf.Bytes())
ndb.recentBatch.Delete(ndb.nodeKey(node.hash))
node.persisted = true
node.saved = true
} else if !node.saved {
node.saved = true
ndb.recentBatch.Set(ndb.nodeKey(node.hash), buf.Bytes())
}
}

Expand Down

0 comments on commit 2e3d3bd

Please sign in to comment.