Skip to content

sgns::blockchain::BlockTreeImpl::TreeNode

More...

Inherits from std::enable_shared_from_this< TreeNode >

Public Functions

Name
TreeNode(primitives::BlockHash hash, primitives::BlockNumber depth, std::shared_ptr< TreeNode > parent, bool finalized =false)
std::shared_ptr< TreeNode > getByHash(const primitives::BlockHash & hash)
bool operator==(const TreeNode & other) const
bool operator!=(const TreeNode & other) const

Public Attributes

Name
primitives::BlockHash block_hash
primitives::BlockNumber depth
std::weak_ptr< TreeNode > parent
bool finalized
std::vector< std::shared_ptr< TreeNode > > children

Detailed Description

struct sgns::blockchain::BlockTreeImpl::TreeNode;

In-memory light representation of the tree, used for efficiency and usage convenience - we would only ask the database for some info, when directly requested

Public Functions Documentation

function TreeNode

TreeNode(
    primitives::BlockHash hash,
    primitives::BlockNumber depth,
    std::shared_ptr< TreeNode > parent,
    bool finalized =false
)

function getByHash

std::shared_ptr< TreeNode > getByHash(
    const primitives::BlockHash & hash
)

Get a node of the tree, containing block with the specified hash, if it can be found

function operator==

bool operator==(
    const TreeNode & other
) const

function operator!=

bool operator!=(
    const TreeNode & other
) const

Public Attributes Documentation

variable block_hash

primitives::BlockHash block_hash;

variable depth

primitives::BlockNumber depth;

variable parent

std::weak_ptr< TreeNode > parent;

variable finalized

bool finalized;

variable children

std::vector< std::shared_ptr< TreeNode > > children;

Updated on 2026-04-15 at 11:00:39 -0700