package
1.7.3
Repository: https://github.com/coderzhi/go-ethereum.git
Documentation: pkg.go.dev

# Functions

New creates a reusable Hasher implements the hash.Hash interface pulls a new Tree from a resource pool for hashing each chunk.
NewEOC creates new end of chunk error with the hash.
NewNode constructor for segment hasher nodes in the BMT.
NewRefHasher returns a new RefHasher.
NewTree initialises the Tree by building up the nodes of a BMT segment size is stipulated to be the size of the hash segmentCount needs to be positive integer and does not need to be a power of two and can even be an odd number segmentSize * segmentCount determines the maximum chunk size hashed using the tree.
NewTreePool creates a Tree pool with hasher, segment size, segment count and capacity on GetTree it reuses free Trees or creates a new one if size is not reached.

# Constants

DefaultPoolSize is the maximum number of bmt trees used by the hashers, i.e, the maximum number of concurrent BMT hashing operations performed by the same hasher.
Should be equal to storage.DefaultBranches.

# Structs

EOC (end of chunk) implements the error interface.
Hasher a reusable hasher for fixed maximum size chunks representing a BMT implements the hash.Hash interface reuse pool of Tree-s for amortised memory allocation and resource control supports order-agnostic concurrent segment writes as well as sequential read and write can not be called concurrently on more than one chunk can be further appended after Sum Reset gives back the Tree to the pool and guaranteed to leave the tree and itself in a state reusable for hashing a new chunk.
Node is a reuseable segment hasher representing a node in a BMT it allows for continued writes after a Sum and is left in completely reusable state after Reset.
RefHasher is the non-optimized easy to read reference implementation of BMT.
Tree is a reusable control structure representing a BMT organised in a binary tree Hasher uses a TreePool to pick one for each chunk hash the Tree is 'locked' while not in the pool.
TreePool provides a pool of Trees used as resources by Hasher a Tree popped from the pool is guaranteed to have clean state for hashing a new chunk Hasher Reset releases the Tree to the pool.

# Type aliases

BaseHasher is a hash.Hash constructor function used for the base hash of the BMT.