Documentation
¶
Index ¶
Constants ¶
View Source
const (
DefaultHeight uint8 = 32
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FullTreer ¶ added in v0.8.0
type FullTreer interface {
ReadTreer
LeafWriter
ReorganizeTreer
}
FullTreer = fully-capable tree (read, write, reorg)
type LeafWriter ¶ added in v0.8.0
type LeafWriter interface {
PutLeaf(tx dbtypes.Txer, blockNum, blockPosition uint64, leaf Leaf) (common.Hash, error)
}
LeafWriter provides write access to a Merkle tree.
type Proof ¶
type Proof [DefaultHeight]common.Hash
func NewProof ¶ added in v0.8.0
func NewProof(proofRaw [DefaultHeight][common.HashLength]byte) Proof
NewProof creates a proof from an array of hashes
type ReadTreer ¶ added in v0.8.0
type ReadTreer interface {
GetRootByIndex(ctx context.Context, index uint32) (Root, error)
GetRootByHash(ctx context.Context, hash common.Hash) (*Root, error)
GetLastRoot(tx dbtypes.Querier) (Root, error)
GetLeaf(tx dbtypes.Querier, index uint32, root common.Hash) (common.Hash, error)
GetProof(ctx context.Context, index uint32, root common.Hash) (Proof, error)
}
ReadTreer provides read-only access to a Merkle tree.
type ReorganizeTreer ¶ added in v0.8.0
type ReorganizeTreer interface {
ReadTreer
Reorg(tx dbtypes.Txer, firstReorgedBlock uint64) error
BackwardToIndex(ctx context.Context, tx dbtypes.Txer, targetIndex uint32) error
}
ReorganizeTreer provides reorg handling for a Merkle tree.
type Root ¶
type Root struct {
Hash common.Hash `meddler:"hash,hash"`
Index uint32 `meddler:"position"`
BlockNum uint64 `meddler:"block_num"`
BlockPosition uint64 `meddler:"block_position"`
// BlockHash is the hash of the block BlockNum, as stored by the syncer. It is not a column of
// the tree, so the tree never fills it: only the syncer queries that serve a root with its block
// hash (e.g. BridgeSync.GetRootByLER) set it, reading it in the same statement as the root.
// Zero if that block has no hash, or when the root was read by any other query.
BlockHash common.Hash `meddler:"-"`
}
Click to show internal directories.
Click to hide internal directories.