Bitcoin full node and query server

May 17, 2021

View in context in the libbitcoin Slack #general mirror.

P
Phil20:22
full_node has a block_chain typed object and when I call node->chain() it returns a safe_chain& typed object. Is it safe for me to typecast the outcome of node->chain() back to block_chain? I wanna poll for what’s the head block’s hash & height, which I cannot get with a `safe_chain` typed object. These are available on `block_chain` only:
    /// Get highest confirmed or candidate header.
    bool get_top(system::chain::header& out_header, size_t& out_height,
        bool candidate) const;

    /// Get highest confirmed or candidate checkpoint.
    bool get_top(system::config::checkpoint& out_checkpoint,
        bool candidate) const;

    /// Get height of highest confirmed or candidate header.
    bool get_top_height(size_t& out_height, bool candidate) const;