Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyProof ¶
func VerifyProof(hash []byte, target *MerkleLeafNode, proof []*MerkleBranchNode) bool
Types ¶
type AlreadyExistsError ¶
type AlreadyExistsError struct { Key []byte Node MerkleNode }
func (*AlreadyExistsError) Error ¶
func (e *AlreadyExistsError) Error() string
type MerkleBranchNode ¶
type MerkleBranchNode struct {
// contains filtered or unexported fields
}
Node in patricia hash trie
func BuildProof ¶
func BuildProof(t *MerkleTrie, target *MerkleLeafNode) ([]*MerkleBranchNode, error)
Returns proof that a key exists within the trie
func (*MerkleBranchNode) Len ¶
func (n *MerkleBranchNode) Len() int
func (*MerkleBranchNode) Repr ¶
func (n *MerkleBranchNode) Repr() []byte
type MerkleHashNode ¶
type MerkleHashNode struct {
// contains filtered or unexported fields
}
func (*MerkleHashNode) Len ¶
func (n *MerkleHashNode) Len() int
func (*MerkleHashNode) Repr ¶
func (n *MerkleHashNode) Repr() []byte
type MerkleLeafData ¶
type MerkleLeafData struct { Key []byte Val interface{} }
type MerkleLeafNode ¶
type MerkleLeafNode struct {
// contains filtered or unexported fields
}
func (*MerkleLeafNode) Equals ¶
func (l *MerkleLeafNode) Equals(r *MerkleLeafNode) bool
func (*MerkleLeafNode) Len ¶
func (n *MerkleLeafNode) Len() int
func (*MerkleLeafNode) Repr ¶
func (n *MerkleLeafNode) Repr() []byte
type MerkleNode ¶
type MerkleTrie ¶
type MerkleTrie struct {
// contains filtered or unexported fields
}
Patricia hash trie
func (*MerkleTrie) Add ¶
func (t *MerkleTrie) Add(key []byte, val interface{}) error
Returns whether addition was successful It will be unsuccessful if the key already exists in the trie
func (*MerkleTrie) Contains ¶
func (t *MerkleTrie) Contains(key []byte) bool
Returns whether the trie contains given key
func (*MerkleTrie) Get ¶
func (t *MerkleTrie) Get(key []byte) interface{}
Returns the value stored at key, nil if the key is not in the trie
type NotFoundError ¶
type NotFoundError struct {
Key []byte
}
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
Click to show internal directories.
Click to hide internal directories.