Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

update root of the dbTree when restoring from DB #623

Open
kautukkundan opened this issue Jul 13, 2021 · 0 comments
Open

update root of the dbTree when restoring from DB #623

kautukkundan opened this issue Jul 13, 2021 · 0 comments

Comments

@kautukkundan
Copy link
Collaborator

kautukkundan commented Jul 13, 2021

Problem

this._root = this.zeros[0] works when we have an empty tree. But we will have a problem once we have new leaves in the tree and have a non-empty tree root in DB.

When we restart the client and read the root() from the DBTree, we expect to read the non-empty tree root in DB. But here the cached root still returns the empty tree root.

Originally posted by @ChihChengLiang in #619 (comment)

Solution

Need to come up with a restoreFromDB function which updates the tree root when the node is restarted. The tree root is already stored in the db and is accessible via getNode(0,0). Rest of the nodes need not be touched.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant