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 <cstdint>
11 : : #include <iostream>
12 : :
13 : : class CBlock;
14 : : class CBlockIndex;
15 : : class CBlockUndo;
16 : : class uint256;
17 : :
18 : : namespace interfaces {
19 : : //! Block data sent with blockConnected, blockDisconnected notifications.
20 : : struct BlockInfo {
21 : : const uint256& hash;
22 : : const uint256* prev_hash = nullptr;
23 : : int height = -1;
24 : : int file_number = -1;
25 : : uint64_t data_pos = 0;
26 : : const CBlock* data = nullptr;
27 : : const 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.
30 : : unsigned int chain_time_max{0};
31 : :
32 [ + - ]: 89847 : BlockInfo(const uint256& hash LIFETIMEBOUND) : hash(hash) {}
33 : : };
34 : : } // namespace interfaces
35 : :
36 : : namespace kernel {
37 : : struct ChainstateRole;
38 : : //! Return data from block index.
39 : : interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* block_index, const CBlock* data = nullptr);
40 : : std::ostream& operator<<(std::ostream& os, const ChainstateRole& role);
41 : : } // namespace kernel
42 : :
43 : : #endif // BITCOIN_KERNEL_CHAIN_H
|