Bitcoin Core 30.99.0
P2P Digital Currency
chain.h
Go to the documentation of this file.
1// Copyright (c) 2022-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_KERNEL_CHAIN_H
6#define BITCOIN_KERNEL_CHAIN_H
7
8#include <attributes.h>
9
10#include <iostream>
11
12class CBlock;
13class CBlockIndex;
14class CBlockUndo;
15class uint256;
16
17namespace interfaces {
19struct BlockInfo {
20 const uint256& hash;
21 const uint256* prev_hash = nullptr;
22 int height = -1;
23 int file_number = -1;
24 unsigned data_pos = 0;
25 const CBlock* data = nullptr;
26 const CBlockUndo* undo_data = nullptr;
27 // The maximum time in the chain up to and including this block.
28 // A timestamp that can only move forward.
29 unsigned int chain_time_max{0};
30
32};
33} // namespace interfaces
34
35namespace kernel {
36struct ChainstateRole;
38interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* block_index, const CBlock* data = nullptr);
39std::ostream& operator<<(std::ostream& os, const ChainstateRole& role);
40} // namespace kernel
41
42#endif // BITCOIN_KERNEL_CHAIN_H
#define LIFETIMEBOUND
Definition: attributes.h:16
Definition: block.h:69
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:95
Undo information for a CBlock.
Definition: undo.h:63
256-bit opaque blob.
Definition: uint256.h:195
interfaces::BlockInfo MakeBlockInfo(const CBlockIndex *index, const CBlock *data)
Return data from block index.
Definition: chain.cpp:18
std::ostream & operator<<(std::ostream &os, const ChainstateRole &role)
Definition: chain.cpp:33
Block data sent with blockConnected, blockDisconnected notifications.
Definition: chain.h:19
unsigned data_pos
Definition: chain.h:24
const uint256 * prev_hash
Definition: chain.h:21
const CBlock * data
Definition: chain.h:25
const uint256 & hash
Definition: chain.h:20
BlockInfo(const uint256 &hash LIFETIMEBOUND)
Definition: chain.h:31
const CBlockUndo * undo_data
Definition: chain.h:26
unsigned int chain_time_max
Definition: chain.h:29