Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAlreadyExists = errors.New("key already exists") ErrNotFound = errors.New("key not found") )
A list of errors that can be returned by the functions of the trie.
Functions ¶
This section is empty.
Types ¶
type Bin ¶
type Bin struct {
// contains filtered or unexported fields
}
Bin represents our own implementation of the patricia merkle trie as specified in the Ethereum yellow paper, with a few simplications due to the simpler structure of the Alvalor blockchain.
func (*Bin) Del ¶
Del will try to delete the hash located at the path provided by the given key. If no hash is found at the given location, it returns false.
func (*Bin) Get ¶
Get will retrieve the hash located at the path provided by the given key. If the path doesn't exist or there is no hash at the given location, it returns a nil slice and false.
func (*Bin) Hash ¶
Hash will return the hash that represents the trie in its entirety by returning the hash of the root node. Currently, it does not do any caching and recomputes the hash from the leafs up. If the root is not initialized, it will return the hash of an empty byte array to uniquely represent a trie without state.
type Hex ¶
type Hex struct {
// contains filtered or unexported fields
}
Hex represents our own implementation of the patricia merkle trie as specified in the Ethereum yellow paper, with a few simplications due to the simpler structure of the Alvalor blockchain.
func (*Hex) Del ¶
Del will try to delete the hash located at the path provided by the given key. If no hash is found at the given location, it returns false.
func (*Hex) Get ¶
Get will retrieve the hash located at the path provided by the given key. If the path doesn't exist or there is no hash at the given location, it returns a nil slice and false.
func (*Hex) Hash ¶
Hash will return the hash that represents the trie in its entirety by returning the hash of the root node. Currently, it does not do any caching and recomputes the hash from the leafs up. If the root is not initialized, it will return the hash of an empty byte array to uniquely represent a trie without state.