Switch block ZMQ notifications to hashblock

This commit is contained in:
Ben
2026-07-13 13:00:26 -04:00
parent 65101a98a2
commit fe287c32c7
9 changed files with 21 additions and 7 deletions
+11 -1
View File
@@ -249,8 +249,18 @@ export class BitcoinRpcService implements OnModuleInit {
console.error('ZMQ Unable to connect, Retrying');
});
const zmqTopics = (this.configService.get<string>('BITCOIN_ZMQ_TOPIC')
?? process.env.BITCOIN_ZMQ_TOPIC
?? 'hashblock')
.split(',')
.map(topic => topic.trim())
.filter(topic => topic.length > 0);
if (zmqTopics.length === 0) {
zmqTopics.push('hashblock');
}
sock.connect(this.configService.get('BITCOIN_ZMQ_HOST'));
sock.subscribe('rawblock');
zmqTopics.forEach(topic => sock.subscribe(topic));
console.log(`ZMQ subscribed to ${zmqTopics.join(',')}`);
// Don't await this, otherwise it will block the rest of the program
this.listenForNewBlocks(sock);