hashnode.go 604 Bytes
Newer Older
1
package trie
obscuren's avatar
obscuren committed
2

obscuren's avatar
obscuren committed
3
import "github.com/ethereum/go-ethereum/common"
4

obscuren's avatar
obscuren committed
5
type HashNode struct {
6 7
	key  []byte
	trie *Trie
obscuren's avatar
obscuren committed
8 9
}

10 11
func NewHash(key []byte, trie *Trie) *HashNode {
	return &HashNode{key, trie}
obscuren's avatar
obscuren committed
12 13 14 15 16 17 18 19 20 21 22
}

func (self *HashNode) RlpData() interface{} {
	return self.key
}

func (self *HashNode) Hash() interface{} {
	return self.key
}

// These methods will never be called but we have to satisfy Node interface
23 24
func (self *HashNode) Value() Node       { return nil }
func (self *HashNode) Dirty() bool       { return true }
obscuren's avatar
obscuren committed
25
func (self *HashNode) Copy(t *Trie) Node { return NewHash(common.CopyBytes(self.key), t) }