Documentation ¶
Index ¶
- Variables
- type CompactMerkleTree
- func (self *CompactMerkleTree) Append(leafv []byte) []common.Uint256
- func (self *CompactMerkleTree) AppendHash(leaf common.Uint256) []common.Uint256
- func (self *CompactMerkleTree) ConsistencyProof(m, n uint32) []common.Uint256
- func (self *CompactMerkleTree) DumpStatus()
- func (self *CompactMerkleTree) GetRootWithNewLeaf(newLeaf common.Uint256) common.Uint256
- func (self *CompactMerkleTree) Hashes() []common.Uint256
- func (self *CompactMerkleTree) InclusionProof(m, n uint32) []common.Uint256
- func (self *CompactMerkleTree) Marshal() ([]byte, error)
- func (self *CompactMerkleTree) Root() common.Uint256
- func (self *CompactMerkleTree) TreeSize() uint32
- func (self *CompactMerkleTree) UnMarshal(buf []byte) error
- type FileHashStore
- type HashStore
- type MemHashStore
- type MerkleVerifier
- func (self *MerkleVerifier) VerifyConsistency(old_tree_size, new_tree_size uint32, old_root, new_root common.Uint256, ...) error
- func (self *MerkleVerifier) VerifyLeafHashInclusion(leaf_hash common.Uint256, leaf_index uint32, proof []common.Uint256, ...) error
- func (self *MerkleVerifier) VerifyLeafInclusion(leaf []byte, leaf_index uint32, proof []common.Uint256, ...) error
- type TreeHasher
Constants ¶
This section is empty.
Variables ¶
View Source
var EMPTY_HASH = common.Uint256{}
Functions ¶
This section is empty.
Types ¶
type CompactMerkleTree ¶
type CompactMerkleTree struct {
// contains filtered or unexported fields
}
func NewTree ¶
func NewTree(tree_size uint32, hashes []common.Uint256, store HashStore) *CompactMerkleTree
func (*CompactMerkleTree) Append ¶
func (self *CompactMerkleTree) Append(leafv []byte) []common.Uint256
func (*CompactMerkleTree) AppendHash ¶
func (self *CompactMerkleTree) AppendHash(leaf common.Uint256) []common.Uint256
func (*CompactMerkleTree) ConsistencyProof ¶
func (self *CompactMerkleTree) ConsistencyProof(m, n uint32) []common.Uint256
func (*CompactMerkleTree) DumpStatus ¶
func (self *CompactMerkleTree) DumpStatus()
func (*CompactMerkleTree) GetRootWithNewLeaf ¶
func (self *CompactMerkleTree) GetRootWithNewLeaf(newLeaf common.Uint256) common.Uint256
func (*CompactMerkleTree) Hashes ¶
func (self *CompactMerkleTree) Hashes() []common.Uint256
func (*CompactMerkleTree) InclusionProof ¶
func (self *CompactMerkleTree) InclusionProof(m, n uint32) []common.Uint256
proof d[m] in D[0:n] m zero based index, n size 1-based
func (*CompactMerkleTree) Marshal ¶
func (self *CompactMerkleTree) Marshal() ([]byte, error)
func (*CompactMerkleTree) Root ¶
func (self *CompactMerkleTree) Root() common.Uint256
func (*CompactMerkleTree) TreeSize ¶
func (self *CompactMerkleTree) TreeSize() uint32
func (*CompactMerkleTree) UnMarshal ¶
func (self *CompactMerkleTree) UnMarshal(buf []byte) error
type FileHashStore ¶
type FileHashStore struct {
// contains filtered or unexported fields
}
func NewFileHashStore ¶
func NewFileHashStore(name string, tree_size uint32) (*FileHashStore, error)
func (*FileHashStore) Close ¶
func (self *FileHashStore) Close()
func (*FileHashStore) Flush ¶
func (self *FileHashStore) Flush() error
type MemHashStore ¶
type MemHashStore struct {
// contains filtered or unexported fields
}
func (*MemHashStore) Close ¶
func (self *MemHashStore) Close()
func (*MemHashStore) Flush ¶
func (self *MemHashStore) Flush() error
type MerkleVerifier ¶
type MerkleVerifier struct {
// contains filtered or unexported fields
}
func NewMerkleVerifier ¶
func NewMerkleVerifier() *MerkleVerifier
func (*MerkleVerifier) VerifyConsistency ¶
func (*MerkleVerifier) VerifyLeafHashInclusion ¶
func (*MerkleVerifier) VerifyLeafInclusion ¶
func (self *MerkleVerifier) VerifyLeafInclusion(leaf []byte, leaf_index uint32, proof []common.Uint256, root_hash common.Uint256, tree_size uint32) error
Verify a Merkle Audit PATH.
leaf: The leaf for which the proof is provided leaf_index: Index of the leaf in the tree. proof: A list of SHA-256 hashes representing the Merkle audit path. tree_size: The size of the tree root_hash: The root hash of the tree
Returns:
nil when the proof is valid
type TreeHasher ¶
type TreeHasher struct { }
func (TreeHasher) HashFullTree ¶
func (self TreeHasher) HashFullTree(leaves [][]byte) common.Uint256
func (TreeHasher) HashFullTreeWithLeafHash ¶
func (self TreeHasher) HashFullTreeWithLeafHash(leaves []common.Uint256) common.Uint256
Click to show internal directories.
Click to hide internal directories.