Problem
Blockbook crashes when used with zebrad (the Rust-based Zcash node that replaces zcashd) because zebrad does not implement ZMQ.
After completing initial sync, blockbook calls InitializeMempool which unconditionally attempts to connect to ZMQ via NewMQ(). When message_queue_binding is empty (or zebrad is not listening on the ZMQ port), the call fails with EINVAL and blockbook exits fatally:
E0408 12:03:42 bitcoinrpc.go:207] mq: invalid argument
E0408 12:03:42 blockbook.go:340] initializeMempool invalid argument
Context
- zcashd (C++ fork of bitcoind) supported ZMQ, but it is deprecated
- zebrad is the actively maintained Zcash node and does not implement ZMQ
- Blockbook's mempool polling via
getrawmempool RPC works fine with zebrad — the issue is only with the mandatory ZMQ initialization
Suggested Fix
In bchain/coins/btc/bitcoinrpc.go, InitializeMempool should skip ZMQ when MessageQueueBinding is empty:
// Current: always attempts ZMQ
if b.mq == nil {
mq, err := bchain.NewMQ(b.ChainConfig.MessageQueueBinding, b.pushHandler, bitcoinTopics)
// Proposed: skip ZMQ when binding is empty, rely on RPC polling
if b.mq == nil && b.ChainConfig.MessageQueueBinding != "" {
mq, err := bchain.NewMQ(b.ChainConfig.MessageQueueBinding, b.pushHandler, bitcoinTopics)
This is backward-compatible — all existing coins with real ZMQ bindings are unaffected. Mempool continues to work via the periodic getrawmempool polling (-resyncmempoolperiod).
An alternative approach would be to add a ZEC-specific override in bchain/coins/zec/zcashrpc.go.
Problem
Blockbook crashes when used with zebrad (the Rust-based Zcash node that replaces zcashd) because zebrad does not implement ZMQ.
After completing initial sync, blockbook calls
InitializeMempoolwhich unconditionally attempts to connect to ZMQ viaNewMQ(). Whenmessage_queue_bindingis empty (or zebrad is not listening on the ZMQ port), the call fails withEINVALand blockbook exits fatally:Context
getrawmempoolRPC works fine with zebrad — the issue is only with the mandatory ZMQ initializationSuggested Fix
In
bchain/coins/btc/bitcoinrpc.go,InitializeMempoolshould skip ZMQ whenMessageQueueBindingis empty:This is backward-compatible — all existing coins with real ZMQ bindings are unaffected. Mempool continues to work via the periodic
getrawmempoolpolling (-resyncmempoolperiod).An alternative approach would be to add a ZEC-specific override in
bchain/coins/zec/zcashrpc.go.