aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Block <ablock84@gmail.com>2024-01-10 14:50:45 +0100
committerAlexander Block <ablock84@gmail.com>2024-01-10 14:53:10 +0100
commit0eddb86dd6ef2726c29613908f9979020632eedc (patch)
tree47311196014239d8be97c916db62b5811105b9c1
parentf7c30f52dca01f68790fdd74f519817c35fdf257 (diff)
downloadgo-git-0eddb86dd6ef2726c29613908f9979020632eedc.tar.gz
utils: update comment in node.go's Hash()
This reflects the lazy hash calculation and the implications of this.
-rw-r--r--utils/merkletrie/filesystem/node.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/utils/merkletrie/filesystem/node.go b/utils/merkletrie/filesystem/node.go
index 6c91f44..3380062 100644
--- a/utils/merkletrie/filesystem/node.go
+++ b/utils/merkletrie/filesystem/node.go
@@ -50,6 +50,10 @@ func NewRootNode(
// difftree algorithm will detect changes in the contents of files and also in
// their mode.
//
+// Please note that the hash is calculated on first invocation of Hash(),
+// meaning that it will not update when the underlying file changes
+// between invocations.
+//
// The hash of a directory is always a 24-bytes slice of zero values
func (n *node) Hash() []byte {
if n.hash == nil {