History
This picks up #33727, which was closed for inactivity
Problem
Currently when a user configures -zmqpub* and the socket can't be bound, the program proceeds normally. The only trace is a debug-level log line that's invisible in a default configuration.
#33715 hit this when their port was already taken.
What this PR does
The node refuses to start if ZMQ is configured and setup failed. This failure is now logged at error level.
Code path: GetNotifiers builds the notifier objects from the config; Create initializes them — starts the ZMQ engine and binds each socket. When initialization fails, Initialize() returns a util::Result carrying an error that names the notifier, the address and the OS error. Create() propagates it and init.cpp returns InitError with that message. On a node with no -zmqpub* option, the notifier list is empty.
Why abort?
#17445 fixed bitcoind crash from bad assert due to ZMQ config (issue #17185). Issue #33715 reports that when ZMQ port was already taken, bitcoind started but user could not see anything with getzmqnotifications. Maintainers at the time agreed it should log louder and abort at startup. Which is what this PR fixes.
Testing
bitcoind -regtest -zmqpubhashblock=foo Result: exits with code 1, and prints:
[error] Failed to bind address foo for pubhashblock: Invalid argument
Error: Failed to bind address foo for pubhashblock: Invalid argument
interface_zmq.py asserts the exact full error message for five startup-failure cases: invalid address, invalid address on a later notifier after an earlier one bound successfully (partial success must still abort), unreachable IP (EADDRNOTAVAIL), and a port already taken by the node's own RPC server (EADDRINUSE, via rpc_port()). The expected errno text is derived with os.strerror on the platform running the test, since the string after the last ":" differs per platform; on Windows the two strings libzmq hardcodes are pinned instead.
Verified locally on Windows; the full CI matrix is green on my fork.
A node with no -zmqpub* options starts exactly as before — nothing changes for nodes that don't use ZMQ.