Documentation
¶
Index ¶
- Constants
- type BlockNode
- type BlocksMMRTree
- func (t *BlocksMMRTree) AddBlock(hash chainhash.Hash, difficulty uint64)
- func (t *BlocksMMRTree) Block(height int32) *BlockNode
- func (t *BlocksMMRTree) Current() *BlockNode
- func (t *BlocksMMRTree) CurrentRoot() chainhash.Hash
- func (t *BlocksMMRTree) Fork() *BlocksMMRTree
- func (t *BlocksMMRTree) LookupNodeByRoot(hash chainhash.Hash) (*BlockNode, bool)
- func (t *BlocksMMRTree) MarshalJSON() ([]byte, error)
- func (t *BlocksMMRTree) Parent(height int32) *BlockNode
- func (t *BlocksMMRTree) ResetRootTo(hash chainhash.Hash, height int32)
- func (t *BlocksMMRTree) RmBlock(hash chainhash.Hash, height int32)
- func (t *BlocksMMRTree) RootForHeight(height int32) chainhash.Hash
- func (t *BlocksMMRTree) SetBlock(hash chainhash.Hash, difficulty uint64, height int32)
- type Leaf
- type Value
Constants ¶
View Source
const ValueSize = 40
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockNode ¶
type BlockNode struct { Leaf ID uint64 // ID of node in the MMR Tree, if ID < math.MaxInt32, ID == block height in main chain. PrevNodeID uint64 // PrevNodeID hash of previous block ActualRoot chainhash.Hash // ActualRoot is a root of the MMR Tree when this node was latest }
func (*BlockNode) MarshalJSON ¶
type BlocksMMRTree ¶
func NewTree ¶
func NewTree() *BlocksMMRTree
func (*BlocksMMRTree) AddBlock ¶
func (t *BlocksMMRTree) AddBlock(hash chainhash.Hash, difficulty uint64)
AddBlock adds block as latest leaf, increases height and rebuild tree.
func (*BlocksMMRTree) Block ¶
func (t *BlocksMMRTree) Block(height int32) *BlockNode
func (*BlocksMMRTree) Current ¶
func (t *BlocksMMRTree) Current() *BlockNode
func (*BlocksMMRTree) CurrentRoot ¶
func (t *BlocksMMRTree) CurrentRoot() chainhash.Hash
func (*BlocksMMRTree) Fork ¶ added in v0.4.2
func (t *BlocksMMRTree) Fork() *BlocksMMRTree
func (*BlocksMMRTree) LookupNodeByRoot ¶
func (t *BlocksMMRTree) LookupNodeByRoot(hash chainhash.Hash) (*BlockNode, bool)
func (*BlocksMMRTree) MarshalJSON ¶ added in v0.4.2
func (t *BlocksMMRTree) MarshalJSON() ([]byte, error)
func (*BlocksMMRTree) Parent ¶
func (t *BlocksMMRTree) Parent(height int32) *BlockNode
func (*BlocksMMRTree) ResetRootTo ¶
func (t *BlocksMMRTree) ResetRootTo(hash chainhash.Hash, height int32)
ResetRootTo sets provided block with <hash, height> as latest and drops all blocks after this.
func (*BlocksMMRTree) RmBlock ¶
func (t *BlocksMMRTree) RmBlock(hash chainhash.Hash, height int32)
RmBlock drops all block from latest to (including) provided block with <hash, height>.
func (*BlocksMMRTree) RootForHeight ¶
func (t *BlocksMMRTree) RootForHeight(height int32) chainhash.Hash
Click to show internal directories.
Click to hide internal directories.