Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not increasing the version when the tree is untouched #128

Closed
b00f opened this issue Feb 28, 2019 · 0 comments
Closed

Not increasing the version when the tree is untouched #128

b00f opened this issue Feb 28, 2019 · 0 comments

Comments

@b00f
Copy link

b00f commented Feb 28, 2019

SaveVersion methods always increase the version of the tree.
I suggest to check the hash before increasing the version, if the hash has not changed, it can simply return the current hash. Something like:

if bytes.Compare(tree.LastHash, tree.WorkingHash()) == 0) // Not Hash()
  return tree.LastHash, tree.version, nil

Changing version will cause changing hash and it can cause application thinks that tree has changed which is not true.

UPDATE:
WorkingHash() (not Hash()) return current Hash.

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

No branches or pull requests

2 participants