Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2022-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_KERNEL_CHAIN_H6#define BITCOIN_KERNEL_CHAIN_H8#include <attributes.h>10#include <cstdint>11#include <iostream>13class CBlock;14class CBlockIndex;15class CBlockUndo;16class uint256;18namespace interfaces {19//! Block data sent with blockConnected, blockDisconnected notifications.20struct BlockInfo {21const uint256& hash;22const uint256* prev_hash = nullptr;23int height = -1;24int file_number = -1;25uint64_t data_pos = 0;26const CBlock* data = nullptr;27const CBlockUndo* undo_data = nullptr;28// The maximum time in the chain up to and including this block.29// A timestamp that can only move forward.30unsigned int chain_time_max{0};32BlockInfo(const uint256& hash LIFETIMEBOUND) : hash(hash) {}33};34} // namespace interfaces36namespace kernel {37struct ChainstateRole;38//! Return data from block index.39interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* block_index, const CBlock* data = nullptr);40std::ostream& operator<<(std::ostream& os, const ChainstateRole& role);41} // namespace kernel43#endif // BITCOIN_KERNEL_CHAIN_H