aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Barbosa <joao.paulo.barbosa@gmail.com>2019-11-11 22:21:43 +0000
committerJoão Barbosa <joao.paulo.barbosa@gmail.com>2020-01-14 09:34:35 +0000
commit179d55f0526082b46415a7f5b6c3742a403f3306 (patch)
tree1bd5cebeee00c2d4259d9993cd0b9a25d4cc781f
parentbb123c6527c02a5936dbf7fee675b992b5c21936 (diff)
downloadbitcoin-179d55f0526082b46415a7f5b6c3742a403f3306.tar.xz
zmq: Fix due to invalid argument and multiple notifiers
Github-Pull: #17445 Rebased-From: 3e730bf90aaf53c41ff3a778f6aac15d163d1c0c
-rw-r--r--src/zmq/zmqpublishnotifier.cpp3
-rwxr-xr-xtest/functional/interface_zmq.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp
index ba89d1401d..233a45d19f 100644
--- a/src/zmq/zmqpublishnotifier.cpp
+++ b/src/zmq/zmqpublishnotifier.cpp
@@ -112,7 +112,8 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
void CZMQAbstractPublishNotifier::Shutdown()
{
- assert(psocket);
+ // Early return if Initialize was not called
+ if (!psocket) return;
int count = mapPublishNotifiers.count(address);
diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py
index 5aea10fbce..89c55f31f3 100755
--- a/test/functional/interface_zmq.py
+++ b/test/functional/interface_zmq.py
@@ -59,6 +59,10 @@ class ZMQTest (BitcoinTestFramework):
# Note that the publishing order is not defined in the documentation and
# is subject to change.
import zmq
+
+ # Invalid zmq arguments don't take down the node, see #17185.
+ self.restart_node(0, ["-zmqpubrawtx=foo", "-zmqpubhashtx=bar"])
+
address = 'tcp://127.0.0.1:28332'
socket = self.ctx.socket(zmq.SUB)
socket.set(zmq.RCVTIMEO, 60000)