Skip to content

Support zebrad (Zcash Rust node) — skip ZMQ when message_queue_binding is empty #1459

@tuan-phan

Description

@tuan-phan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions