diff --git a/internal/trie/node/node.go b/internal/trie/node/node.go index 6c306979bbe..681094eecaf 100644 --- a/internal/trie/node/node.go +++ b/internal/trie/node/node.go @@ -11,6 +11,7 @@ type Node interface { IsDirty() bool SetDirty(dirty bool) SetKey(key []byte) + SetValue(value []byte) String() string SetEncodingAndHash(encoding []byte, hash []byte) GetHash() (hash []byte) diff --git a/internal/trie/node/value.go b/internal/trie/node/value.go index 5ab07fb5894..9e85e2e7cb2 100644 --- a/internal/trie/node/value.go +++ b/internal/trie/node/value.go @@ -16,3 +16,17 @@ func (b *Branch) GetValue() (value []byte) { func (l *Leaf) GetValue() (value []byte) { return l.Value } + +// SetValue sets the byte slice given to the value of the branch. +// Note it does not copy the byte slice so modifying the passed +// byte slice will modify the byte slice of the branch. +func (b *Branch) SetValue(value []byte) { + b.Value = value +} + +// SetValue sets the byte slice given to the value of the leaf. +// Note it does not copy the byte slice so modifying the passed +// byte slice will modify the byte slice of the leaf. +func (l *Leaf) SetValue(value []byte) { + l.Value = value +}