Skip to content

Commit f073917

Browse files
committed
validationinterface: only send zmq notifications for active
1 parent 4d8f4dc commit f073917

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

doc/zmq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ Where the 8-byte uints correspond to the mempool sequence number.
113113
| hashtx | <32-byte transaction hash in Little Endian> | <uint32 sequence number in Little Endian>
114114

115115

116-
`rawblock`: Notifies when the chain tip is updated. Messages are ZMQ multipart messages with three parts. The first part is the topic (`rawblock`), the second part is the serialized block, and the last part is a sequence number (representing the message count to detect lost messages).
116+
`rawblock`: Notifies when the chain tip is updated. When assumeutxo is in use, this notification will not be issued for historical blocks connected to the background validation chainstate. Messages are ZMQ multipart messages with three parts. The first part is the topic (`rawblock`), the second part is the serialized block, and the last part is a sequence number (representing the message count to detect lost messages).
117117

118118
| rawblock | <serialized block> | <uint32 sequence number in Little Endian>
119119

120-
`hashblock`: Notifies when the chain tip is updated. Messages are ZMQ multipart messages with three parts. The first part is the topic (`hashblock`), the second part is the 32-byte block hash, and the last part is a sequence number (representing the message count to detect lost messages).
120+
`hashblock`: Notifies when the chain tip is updated. When assumeutxo is in use, this notification will not be issued for historical blocks connected to the background validation chainstate. Messages are ZMQ multipart messages with three parts. The first part is the topic (`hashblock`), the second part is the 32-byte block hash, and the last part is a sequence number (representing the message count to detect lost messages).
121121

122122
| hashblock | <32-byte block hash in Little Endian> | <uint32 sequence number in Little Endian>
123123

src/zmq/zmqnotificationinterface.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ void CZMQNotificationInterface::TransactionRemovedFromMempool(const CTransaction
173173

174174
void CZMQNotificationInterface::BlockConnected(ChainstateRole role, const std::shared_ptr<const CBlock>& pblock, const CBlockIndex* pindexConnected)
175175
{
176+
if (role == ChainstateRole::BACKGROUND) {
177+
return;
178+
}
176179
for (const CTransactionRef& ptx : pblock->vtx) {
177180
const CTransaction& tx = *ptx;
178181
TryForEachAndRemoveFailed(notifiers, [&tx](CZMQAbstractNotifier* notifier) {

0 commit comments

Comments
 (0)