Bitcoin Core  31.0.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 
12 class CBlock;
13 class CBlockIndex;
14 class CBlockUndo;
15 class uint256;
16 
17 namespace interfaces {
19 struct 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 
35 namespace kernel {
36 struct ChainstateRole;
38 interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* block_index, const CBlock* data = nullptr);
39 std::ostream& operator<<(std::ostream& os, const ChainstateRole& role);
40 } // namespace kernel
41 
42 #endif // BITCOIN_KERNEL_CHAIN_H
Definition: block.h:73
BlockInfo(const uint256 &hash LIFETIMEBOUND)
Definition: chain.h:31
unsigned data_pos
Definition: chain.h:24
const uint256 & hash
Definition: chain.h:20
Block data sent with blockConnected, blockDisconnected notifications.
Definition: chain.h:19
const CBlock * data
Definition: chain.h:25
#define LIFETIMEBOUND
Definition: attributes.h:16
const uint256 * prev_hash
Definition: chain.h:21
256-bit opaque blob.
Definition: uint256.h:195
std::ostream & operator<<(std::ostream &os, const ChainstateRole &role)
Definition: chain.cpp:33
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:93
Undo information for a CBlock.
Definition: undo.h:62
interfaces::BlockInfo MakeBlockInfo(const CBlockIndex *index, const CBlock *data)
Return data from block index.
Definition: chain.cpp:18
unsigned int chain_time_max
Definition: chain.h:29
const CBlockUndo * undo_data
Definition: chain.h:26