Documentation ¶
Index ¶
- func PcpHash(annHashes *[4][32]byte, annCount uint64, annIndexes *[4]uint64, ...) (*[32]byte, er.R)
- type Flag
- type Tree
- type TreeNode
- func (te *TreeNode) End() uint64
- func (te *TreeNode) Flags() Flag
- func (te *TreeNode) GetParent() *TreeNode
- func (te *TreeNode) GetSibling() *TreeNode
- func (te *TreeNode) HasExplicitRange() bool
- func (te *TreeNode) Hash() []byte
- func (te *TreeNode) Number() int
- func (te *TreeNode) Range() uint64
- func (te *TreeNode) SetEnd(s uint64) bool
- func (te *TreeNode) SetHash(h []byte) bool
- func (te *TreeNode) SetRange(s uint64) bool
- func (te *TreeNode) SetStart(s uint64) bool
- func (te *TreeNode) Start() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Flag ¶
type Flag uint16
Flag is a flag which is applied to tree entries to indicate their state
const ( // FComputable means no information will be provided about this node because // it can be fully computed (both child nodes are known) FComputable Flag = 1 // FPadEntry means this is a pad entry (added to make the number of nodes even) // no information is provided because it's hard-wired to all ff FPadEntry Flag = (1 << 1) // FLeaf this node is canadian, it corrisponds to an announcement hash // (including the ones which we're proving) FLeaf Flag = (1 << 2) // FRight means this node is a right-hand node, if this flag is not present then // the node is left-hand or is the root FRight Flag = (1 << 3) // FPadSibling left sibling of a pad entry, in practice this will always be // COMPUTABLE and so no information is provided anyway but it is here for completeness. FPadSibling Flag = (1 << 4) // FFirstEntry means the node is the first node in the layer (index 0), this // means the "start" for this node is known, it is 0 FFirstEntry Flag = (1 << 5) // FHasHash is set when we know the hash for a given node, it means the hash // value is meaningful FHasHash Flag = (1 << 8) // FHasRange is set when we know the range for a node FHasRange Flag = (1 << 9) // FHasStart is set when we know the start for a node. FHasStart Flag = (1 << 10) // FHasEnd means that we know the end of a node's range. FHasEnd Flag = (1 << 11) )
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
func (*Tree) GetAnnEntry ¶
GetAnnEntry gets the table netry corrisponding to a particular announcement.
type TreeNode ¶
type TreeNode struct {
// contains filtered or unexported fields
}
func (*TreeNode) GetSibling ¶
GetSibling returns the node's sibling, nil for the root node
func (*TreeNode) HasExplicitRange ¶
HasExplicitRange returns true if the entry requires an explicit range in order to validate
func (*TreeNode) Range ¶
Range gets the difference between the start and the end if it is not yet known then the result will be 0
func (*TreeNode) SetEnd ¶
SetEnd sets the end of the node's range, if the range is known then the start will be inferred and saved.
func (*TreeNode) SetHash ¶
SetHash sets the provided byte array to the entry hash and flags as hash present
func (*TreeNode) SetRange ¶
SetRange sets the range for a node, if the start is known then the start and end are computed and saved. If the range has already been set then this function returns false