mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
interfaces, refactor: Add more block information to block connected notifications
Add new interfaces::BlockInfo struct to be able to pass extra block information (file and undo information) to indexes which they are updated to use high level interfaces::Chain notifications. This commit does not change behavior in any way.
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
class ArgsManager;
|
||||
class CBlock;
|
||||
class CBlockUndo;
|
||||
class CFeeRate;
|
||||
class CRPCCommand;
|
||||
class CScheduler;
|
||||
@@ -67,6 +68,19 @@ public:
|
||||
mutable bool found = false;
|
||||
};
|
||||
|
||||
//! Block data sent with blockConnected, blockDisconnected notifications.
|
||||
struct BlockInfo {
|
||||
const uint256& hash;
|
||||
const uint256* prev_hash = nullptr;
|
||||
int height = -1;
|
||||
int file_number = -1;
|
||||
unsigned data_pos = 0;
|
||||
const CBlock* data = nullptr;
|
||||
const CBlockUndo* undo_data = nullptr;
|
||||
|
||||
BlockInfo(const uint256& hash LIFETIMEBOUND) : hash(hash) {}
|
||||
};
|
||||
|
||||
//! Interface giving clients (wallet processes, maybe other analysis tools in
|
||||
//! the future) ability to access to the chain state, receive notifications,
|
||||
//! estimate fees, and submit transactions.
|
||||
@@ -239,8 +253,8 @@ public:
|
||||
virtual ~Notifications() {}
|
||||
virtual void transactionAddedToMempool(const CTransactionRef& tx, uint64_t mempool_sequence) {}
|
||||
virtual void transactionRemovedFromMempool(const CTransactionRef& tx, MemPoolRemovalReason reason, uint64_t mempool_sequence) {}
|
||||
virtual void blockConnected(const CBlock& block, int height) {}
|
||||
virtual void blockDisconnected(const CBlock& block, int height) {}
|
||||
virtual void blockConnected(const BlockInfo& block) {}
|
||||
virtual void blockDisconnected(const BlockInfo& block) {}
|
||||
virtual void updatedBlockTip() {}
|
||||
virtual void chainStateFlushed(const CBlockLocator& locator) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user