Skip to content

Commit aa9b488

Browse files
kernel: deduplicate BlockInfo declarations
1 parent caa629a commit aa9b488

2 files changed

Lines changed: 12 additions & 37 deletions

File tree

‎src/interfaces/chain.h‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
class ArgsManager;
2222
class CBlock;
23-
class CBlockUndo;
2423
class CFeeRate;
2524
class CRPCCommand;
2625
class CScheduler;
@@ -90,22 +89,6 @@ class FoundBlock
9089
mutable bool found = false;
9190
};
9291

93-
//! Block data sent with blockConnected, blockDisconnected notifications.
94-
struct BlockInfo {
95-
const uint256& hash;
96-
const uint256* prev_hash = nullptr;
97-
int height = -1;
98-
int file_number = -1;
99-
unsigned data_pos = 0;
100-
const CBlock* data = nullptr;
101-
const CBlockUndo* undo_data = nullptr;
102-
// The maximum time in the chain up to and including this block.
103-
// A timestamp that can only move forward.
104-
unsigned int chain_time_max{0};
105-
106-
BlockInfo(const uint256& hash LIFETIMEBOUND) : hash(hash) {}
107-
};
108-
10992
//! Interface giving clients (wallet processes, maybe other analysis tools in
11093
//! the future) ability to access to the chain state, receive notifications,
11194
//! estimate fees, and submit transactions.

‎src/kernel/chain.h‎

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,29 @@
55
#ifndef BITCOIN_KERNEL_CHAIN_H
66
#define BITCOIN_KERNEL_CHAIN_H
77

8-
#include<iostream>
9-
10-
class CBlock;
11-
class CBlockIndex;
12-
namespace interfaces {
13-
struct BlockInfo;
14-
} // namespace interfaces
8+
#include <attributes.h>
159

16-
namespace kernel {
17-
//! Return data from block index.
18-
interfaces::BlockInfo MakeBlockInfo(const CBlockIndex* block_index, const CBlock* data = nullptr);
19-
20-
} // namespace kernel
10+
#include<iostream>
2111

2212
class CBlock;
2313
class CBlockIndex;
2414
class CBlockUndo;
2515
class uint256;
2616
namespace interfaces {
27-
//! Block data sent with blockConnected and blockDisconnected notifications.
17+
//! Block data sent with blockConnected, blockDisconnected notifications.
2818
struct BlockInfo {
2919
const uint256& hash;
30-
const uint256* prev_hash{nullptr};
31-
int height{-1};
32-
int file_number{-1};
33-
unsigned data_pos{0};
34-
const CBlock* data{nullptr};
35-
const CBlockUndo* undo_data{nullptr};
20+
const uint256* prev_hash = nullptr;
21+
int height = -1;
22+
int file_number = -1;
23+
unsigned data_pos = 0;
24+
const CBlock* data = nullptr;
25+
const CBlockUndo* undo_data = nullptr;
26+
// The maximum time in the chain up to and including this block.
27+
// A timestamp that can only move forward.
3628
unsigned int chain_time_max{0};
3729

38-
explicit BlockInfo(const uint256& block_hash) : hash(block_hash) {}
30+
BlockInfo(const uint256& hash LIFETIMEBOUND) : hash(hash) {}
3931
};
4032
} // namespace interfaces
4133

0 commit comments

Comments
 (0)