aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-01-13 07:55:18 -0500
committerRyan Ofsky <ryan@ofsky.org>2022-07-18 13:39:55 -0500
commita0b5b4ae5a24536d333cbce2ea584f2d935c651f (patch)
tree71fbd31c68142216d20ff3414d9360feee5baa3e /src/interfaces
parent8d4a058ac421da838422da127aac71abf83a49f6 (diff)
downloadbitcoin-a0b5b4ae5a24536d333cbce2ea584f2d935c651f.tar.xz
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.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/chain.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index ff994b8edc..6396d0d359 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -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) {}
};