Branch data Line data Source code
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 {
18 : : //! Block data sent with blockConnected, blockDisconnected notifications.
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 : :
31 [ + - ]: 81042 : BlockInfo(const uint256& hash LIFETIMEBOUND) : hash(hash) {}
32 : : };
33 : : } // namespace interfaces
34 : :
35 : : namespace kernel {
36 : : struct ChainstateRole;
37 : : //! Return data from block index.
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
|