From 54bf34de1f0eda2a07ec125753ef76d38a977e66 Mon Sep 17 00:00:00 2001 From: everoddandeven Date: Sat, 14 Nov 2026 03:06:04 +0100 Subject: [PATCH] tests: add zmq listening Point external/monero-cpp at woodser/monero-cpp#204 (branch d8, 4c248fa), which supersedes the daemon-zmq-listener branch. Its subscriber no longer reports its connection, so is_connected() and get_num_connections() are not bound, and the test checks the publications and the errors of subscribe_zmq() instead. Co-Authored-By: Claude Sonnet 5.5 --- CMakeLists.txt | 24 ++++++++++++ docs/mkdocs/docs/en/api/connection.md | 37 ++++++++++++++++++ docs/mkdocs/docs/en/api/daemon_rpc.md | 18 +++++++++ .../docs/en/api/data_model/connection.md | 6 +++ .../examples/basics/listening_to_a_wallet.md | 3 ++ external/monero-cpp | 2 +- src/cpp/common/py_monero_common_bindings.cpp | 18 +++++++++ src/cpp/py_monero_types.h | 4 ++ src/monero/__init__.pyi | 4 ++ src/monero/monero_daemon_rpc.pyi | 4 +- src/monero/monero_rpc_connection.pyi | 15 +++++++- src/monero/monero_zmq_publication.pyi | 11 ++++++ src/monero/monero_zmq_subscriber.pyi | 23 +++++++++++ tests/common/test_rpc_connection.py | 38 ++++++++++++++++++- tests/utils/test_utils.py | 9 ++++- 15 files changed, 209 insertions(+), 7 deletions(-) create mode 100644 src/monero/monero_zmq_publication.pyi create mode 100644 src/monero/monero_zmq_subscriber.pyi diff --git a/CMakeLists.txt b/CMakeLists.txt index cfb39b0b..f37e30bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,6 +316,28 @@ message(STATUS "Using HIDAPI include dir at ${HIDAPI_INCLUDE_DIR}") find_library(SODIUM_LIBRARY sodium REQUIRED) message(STATUS "Using libsodium library at ${SODIUM_LIBRARY}") +############ +# libzmq +############ + +# link before libsodium, which static libzmq depends on +find_library(ZMQ_LIBRARY zmq REQUIRED) +set(ZMQ_LIBRARIES ${ZMQ_LIBRARY}) +if (ZMQ_LIBRARY MATCHES "\\.a$") + # optional transports of static libzmq + foreach(zmq_dep pgm norm gssapi_krb5 protolib protokit bsd md) + string(TOUPPER ${zmq_dep} zmq_dep_var) + find_library(ZMQ_DEP_${zmq_dep_var} ${zmq_dep}) + if (ZMQ_DEP_${zmq_dep_var}) + list(APPEND ZMQ_LIBRARIES ${ZMQ_DEP_${zmq_dep_var}}) + endif() + endforeach() +endif() +if (WIN32) + list(APPEND ZMQ_LIBRARIES ws2_32 rpcrt4 iphlpapi) +endif() +message(STATUS "Using libzmq libraries: ${ZMQ_LIBRARIES}") + ############ # Protobuf ############ @@ -403,6 +425,8 @@ set(MONERO_PYTHON_LINK_LIBS ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${Protobuf_LIBRARY} + # before libsodium, which static libzmq depends on + ${ZMQ_LIBRARIES} ${SODIUM_LIBRARY} # after hidapi, which uses it: with --as-needed the linker keeps a shared library only for what comes before it ${HIDAPI_LIBRARIES} diff --git a/docs/mkdocs/docs/en/api/connection.md b/docs/mkdocs/docs/en/api/connection.md index 6683a878..5012b384 100644 --- a/docs/mkdocs/docs/en/api/connection.md +++ b/docs/mkdocs/docs/en/api/connection.md @@ -10,6 +10,7 @@ A [`MoneroRpcConnection`][monero.MoneroRpcConnection] is how a daemon or a walle | `uri` | the address of the server, `http://host:port` or `https://...` | | `username`, `password` | the login of its RPC, `--rpc-login` of the server ([`set_credentials`][monero.MoneroRpcConnection.set_credentials]) | | `proxy_uri` | a proxy for the requests, as the SOCKS of Tor to reach an onion address | +| `zmq_uri` | the ZMQ publisher of a daemon, `--zmq-pub` of `monerod`, as `tcp://127.0.0.1:18083`: [ZMQ](#zmq) | | `timeout_ms` | how long a request waits for the answer: 3 minutes when not set | | `ssl_verify` | whether the certificate of an `https` server is checked | @@ -20,4 +21,40 @@ called with [`send_json_request`][monero.MoneroRpcConnection.send_json_request], other interfaces of the daemon ([Connect to RPC Server](../examples/basics/connect_to_rpc_server.md)). Their response is parsed as Python's `json` module parses it, and they run without the GIL: threads with a connection each send their requests at once. +## ZMQ + +A `monerod` that runs with `--zmq-pub` publishes what happens on its chain and in its pool over ZMQ: a block added to the chain, a +transaction that enters the pool. It is the `zmq_uri` of the connection, which is not the one of `--zmq-rpc-bind-port`, and +[`subscribe_zmq`][monero.MoneroRpcConnection.subscribe_zmq] connects to it and returns a +[`MoneroZmqSubscriber`][monero.MoneroZmqSubscriber], which gives the [`MoneroZmqPublication`][monero.MoneroZmqPublication] of the topics that +it was asked for. The `json` of a publication is the text that the daemon published: + +```python +import json + +from monero import MoneroRpcConnection + +connection = MoneroRpcConnection("http://localhost:18081", zmq_uri="tcp://127.0.0.1:18083") +subscriber = connection.subscribe_zmq(["json-minimal-chain_main"]) + +publication = subscriber.wait_for_publication(10000) +if publication is not None: + print(publication.topic, json.loads(publication.json)) +``` + +- [`wait_for_publication`][monero.MoneroZmqSubscriber.wait_for_publication] waits as long as it is told for the next publication, and gives + `None` if there is none by then. It runs without the GIL, as the requests do. + [`discard_publications`][monero.MoneroZmqSubscriber.discard_publications] drops those that are waiting, for a program that only cares for + what happens next. +- ZMQ matches a topic by its start: `json-minimal` takes all the publications of the minimal JSON, and `json-minimal-chain_main` only the + ones of the blocks that are added to the main chain. +- The subscriber connects in the background, and again every second if it loses the daemon: `subscribe_zmq` does not fail because the + daemon is not there. A publication that the daemon makes while the subscriber is not connected is lost, and ZMQ does not send it again: a + program that can not miss a block reads the chain from the daemon too. +- A subscriber is used by one thread at a time. +- `subscribe_zmq` raises a [`MoneroError`][monero.MoneroError] if the connection has no `zmq_uri`, and if it has a `proxy_uri`: ZMQ connects + directly, and would skip the proxy. + +A [`MoneroDaemonRpc`][monero.MoneroDaemonRpc] uses it to learn of the new blocks sooner: [Daemon RPC](daemon_rpc.md#zmq). + ::: monero.MoneroRpcConnection diff --git a/docs/mkdocs/docs/en/api/daemon_rpc.md b/docs/mkdocs/docs/en/api/daemon_rpc.md index d7a82a67..2e1d22dd 100644 --- a/docs/mkdocs/docs/en/api/daemon_rpc.md +++ b/docs/mkdocs/docs/en/api/daemon_rpc.md @@ -7,4 +7,22 @@ The client of the RPC of a `monerod` ([Interact with RPC Daemon](../examples/bas of the daemon and its credentials, or with a [`MoneroRpcConnection`][monero.MoneroRpcConnection], and polls the daemon for its [listeners](../examples/basics/listening_to_a_wallet.md#a-daemon). +## ZMQ + +A daemon is polled every [`set_poll_period_in_ms`][monero.MoneroDaemonRpc.set_poll_period_in_ms], 10 seconds when it is not set, to tell its +listeners of a new block, which may then be one period late. If its connection has a `zmq_uri`, the `--zmq-pub` of the `monerod` +([ZMQ](connection.md#zmq)), the daemon is polled also each time the `monerod` publishes a block, and the listeners are told as it is added: + +```python +from monero import MoneroDaemonRpc + +daemon = MoneroDaemonRpc("http://localhost:18081", zmq_uri="tcp://127.0.0.1:18083") +``` + +The period still holds: ZMQ does not guarantee that a publication arrives, so the daemon is polled every period whether the `monerod` +publishes or not, and a block that it did not publish is told at most a period late. The daemon is polled by the period alone when the +connection has no `zmq_uri`, when it has a `proxy_uri` (ZMQ connects directly, and would skip it), and when the subscription fails, which is +logged. The `zmq_uri` and the `proxy_uri` are read at each poll, so a connection that changes them while the daemon is listened to is +followed. + ::: monero.MoneroDaemonRpc diff --git a/docs/mkdocs/docs/en/api/data_model/connection.md b/docs/mkdocs/docs/en/api/data_model/connection.md index 5a24e229..99b24135 100644 --- a/docs/mkdocs/docs/en/api/data_model/connection.md +++ b/docs/mkdocs/docs/en/api/data_model/connection.md @@ -9,7 +9,13 @@ The classes around a [`MoneroRpcConnection`][monero.MoneroRpcConnection], the co | --- | --- | | [`SslOptions`][monero.SslOptions] | the SSL of a connection: the certificates, and how the one of the server is checked; passed to [`MoneroWalletRpc.set_daemon_connection`][monero.MoneroWalletRpc.set_daemon_connection] | | [`MoneroConnectionType`][monero.MoneroConnectionType] | how a peer of a daemon is connected, IPv4, IPv6, Tor or I2P: the `connection_type` of a [`MoneroPeer`][monero.MoneroPeer] | +| [`MoneroZmqSubscriber`][monero.MoneroZmqSubscriber] | what [`subscribe_zmq`][monero.MoneroRpcConnection.subscribe_zmq] returns: it waits for the publications of the ZMQ publisher of a daemon ([ZMQ](../connection.md#zmq)) | +| [`MoneroZmqPublication`][monero.MoneroZmqPublication] | a publication of a daemon: its `topic` and its `json`, which a [`MoneroZmqSubscriber`][monero.MoneroZmqSubscriber] gives | ::: monero.SslOptions ::: monero.MoneroConnectionType + +::: monero.MoneroZmqSubscriber + +::: monero.MoneroZmqPublication diff --git a/docs/mkdocs/docs/en/examples/basics/listening_to_a_wallet.md b/docs/mkdocs/docs/en/examples/basics/listening_to_a_wallet.md index 9c96c3f8..8dee6930 100644 --- a/docs/mkdocs/docs/en/examples/basics/listening_to_a_wallet.md +++ b/docs/mkdocs/docs/en/examples/basics/listening_to_a_wallet.md @@ -111,4 +111,7 @@ daemon = MoneroDaemonRpc("http://localhost:38081") daemon.add_listener(NewBlocks()) ``` +The daemon is polled every few seconds. Given the `zmq_uri` of a `monerod` that runs with `--zmq-pub`, it is also polled when the `monerod` +publishes a block, and the listener is told as it is added: [ZMQ](../../api/daemon_rpc.md#zmq). + A shop that watches the payments of its orders uses them: [Accepting Payments in a Shop](../scenarios/accepting_payments.md). diff --git a/external/monero-cpp b/external/monero-cpp index 5b0b3ca1..4c248fa8 160000 --- a/external/monero-cpp +++ b/external/monero-cpp @@ -1 +1 @@ -Subproject commit 5b0b3ca1c250c096f2ed389091dd24c16b84a003 +Subproject commit 4c248fa86b37394ecb95c1cbdfa754f3617b6940 diff --git a/src/cpp/common/py_monero_common_bindings.cpp b/src/cpp/common/py_monero_common_bindings.cpp index f3e473ac..19f80fe0 100644 --- a/src/cpp/common/py_monero_common_bindings.cpp +++ b/src/cpp/common/py_monero_common_bindings.cpp @@ -261,6 +261,21 @@ void py_monero_bind_common(py::module_& m, PyMoneroTypes& t) { .def_readwrite("ssl_allowed_fingerprints", &ssl_options::m_ssl_allowed_fingerprints) .def_readwrite("ssl_allow_any_cert", &ssl_options::m_ssl_allow_any_cert); + // monero_zmq_publication + t.py_monero_zmq_publication + .def(py::init<>()) + .def_readwrite("topic", &monero_zmq_publication::m_topic) + .def_readwrite("json", &monero_zmq_publication::m_json); + + // monero_zmq_subscriber + t.py_monero_zmq_subscriber + .def("wait_for_publication", [](monero_zmq_subscriber& self, int timeout_ms) { + MONERO_CATCH_AND_RETHROW(self.wait_for_publication(timeout_ms)); + }, py::arg("timeout_ms"), py::call_guard()) + .def("discard_publications", [](monero_zmq_subscriber& self) { + MONERO_CATCH_AND_RETHROW(self.discard_publications()); + }, py::call_guard()); + // monero_rpc_connection t.py_monero_rpc_connection .def(py::init&>(), py::arg("uri") = "", py::arg("username") = "", py::arg("password") = "", py::arg("proxy_uri") = "", py::arg("zmq_uri") = "", py::arg("priority") = 0, py::arg("timeout_ms") = py::none()) @@ -344,6 +359,9 @@ void py_monero_bind_common(py::module_& m, PyMoneroTypes& t) { .def("check_connection", [](monero_rpc_connection& self, const boost::optional& timeout_ms) { MONERO_CATCH_AND_RETHROW(self.check_connection(timeout_ms)); }, py::arg("timeout_ms") = py::none(), py::call_guard()) + .def("subscribe_zmq", [](const monero_rpc_connection& self, const std::vector& topics) { + MONERO_CATCH_AND_RETHROW(std::shared_ptr(self.subscribe_zmq(topics))); + }, py::arg("topics"), py::call_guard()) // the parameters are serialized with the GIL held, then the request runs without it, so that the requests of other threads and a // server in this process run meanwhile. The JSON responses are parsed from their raw body with python's json .def("send_json_request", [](monero_rpc_connection& self, const std::string &method, const boost::optional& parameters, const boost::optional& timeout_ms) { diff --git a/src/cpp/py_monero_types.h b/src/cpp/py_monero_types.h index 92ef271f..0a9fbd6f 100644 --- a/src/cpp/py_monero_types.h +++ b/src/cpp/py_monero_types.h @@ -134,6 +134,8 @@ struct PyMoneroTypes { py::class_> py_monero_rpc_payment_info; py::class_> py_monero_rpc_connection; + py::class_> py_monero_zmq_publication; + py::class_> py_monero_zmq_subscriber; py::class_> py_monero_ssl_options; py::class_> py_monero_version; py::class_> py_monero_block_header; @@ -188,6 +190,8 @@ struct PyMoneroTypes { py_serializable_struct(m, "SerializableStruct"), py_monero_rpc_payment_info(m, "MoneroRpcPaymentInfo"), py_monero_rpc_connection(m, "MoneroRpcConnection"), + py_monero_zmq_publication(m, "MoneroZmqPublication"), + py_monero_zmq_subscriber(m, "MoneroZmqSubscriber"), py_monero_ssl_options(m, "SslOptions"), py_monero_version(m, "MoneroVersion"), py_monero_block_header(m, "MoneroBlockHeader"), diff --git a/src/monero/__init__.pyi b/src/monero/__init__.pyi index 5621550d..96389e93 100644 --- a/src/monero/__init__.pyi +++ b/src/monero/__init__.pyi @@ -118,6 +118,8 @@ from .monero_peer import MoneroPeer from .monero_prune_result import MoneroPruneResult from .monero_rpc_connection import MoneroRpcConnection from .monero_rpc_error import MoneroRpcError +from .monero_zmq_publication import MoneroZmqPublication +from .monero_zmq_subscriber import MoneroZmqSubscriber from .ssl_options import SslOptions from .monero_subaddress import MoneroSubaddress from .monero_submit_tx_result import MoneroSubmitTxResult @@ -204,6 +206,8 @@ __all__ = [ 'MoneroPruneResult', 'MoneroRpcConnection', 'MoneroRpcError', + 'MoneroZmqPublication', + 'MoneroZmqSubscriber', 'MoneroSubaddress', 'MoneroSubmitTxResult', 'MoneroSyncResult', diff --git a/src/monero/monero_daemon_rpc.pyi b/src/monero/monero_daemon_rpc.pyi index 4470729e..d58883e1 100644 --- a/src/monero/monero_daemon_rpc.pyi +++ b/src/monero/monero_daemon_rpc.pyi @@ -33,7 +33,7 @@ class MoneroDaemonRpc(MoneroDaemon): :param str username: Authentication username for daemon RPC. :param str password: Authentication password for daemon RPC. :param str proxy_uri: Connection proxy. - :param str zmq_uri: RPC ZMQ uri. + :param str zmq_uri: uri of the ZMQ publisher of the daemon (`--zmq-pub` of `monerod`), which makes the daemon poll when a block is published. :param int timeout_ms: Connection timeout in milliseconds (default 3 minutes). """ ... @@ -50,6 +50,8 @@ class MoneroDaemonRpc(MoneroDaemon): """ Set the period between polls of the daemon for block notifications. + With a ZMQ uri the daemon is also polled when `monerod` publishes a block, and a block that it did not publish is notified at most a period late. + :param int period_ms: the poll period in milliseconds. """ ... diff --git a/src/monero/monero_rpc_connection.pyi b/src/monero/monero_rpc_connection.pyi index af701fa0..b57acfa5 100644 --- a/src/monero/monero_rpc_connection.pyi +++ b/src/monero/monero_rpc_connection.pyi @@ -1,5 +1,6 @@ import typing +from .monero_zmq_subscriber import MoneroZmqSubscriber from .serializable_struct import SerializableStruct @@ -11,7 +12,7 @@ class MoneroRpcConnection(SerializableStruct): proxy_uri: str | None """Connection proxy address.""" zmq_uri: str | None - """ZMQ connection uri.""" + """Uri of the ZMQ publisher of the daemon, `--zmq-pub` of `monerod`, e.g. `tcp://127.0.0.1:18083`.""" timeout_ms: int | None """Connection timeout (milliseconds): `None` waits the default of 3 minutes.""" ssl_verify: bool @@ -95,7 +96,7 @@ class MoneroRpcConnection(SerializableStruct): :param str username: username used for authentication. :param str password: password used for authentication. :param str proxy_uri: proxy uri. - :param str zmq_uri: ZMQ uri. + :param str zmq_uri: uri of the ZMQ publisher of the daemon (`--zmq-pub` of `monerod`). :param int priority: priorioty of the connection. :param int|None timeout_ms: connection timeout in milliseconds. """ @@ -192,6 +193,16 @@ class MoneroRpcConnection(SerializableStruct): """ ... + def subscribe_zmq(self, topics: list[str]) -> MoneroZmqSubscriber: + """ + Subscribe to the publications of the connection's zmq uri. + + :param list[str] topics: topics to receive, e.g. `json-minimal-chain_main`. + :returns MoneroZmqSubscriber: the subscriber. + :raises MoneroError: if the connection has no zmq uri, uses a proxy (zmq would connect directly), or the subscription fails. + """ + ... + def send_path_request(self, method: str, parameters: object | None = None, timeout_ms: int | None = None) -> object | None: """ Send a RPC request to the given path and with the given parameters. diff --git a/src/monero/monero_zmq_publication.pyi b/src/monero/monero_zmq_publication.pyi new file mode 100644 index 00000000..f02bb80e --- /dev/null +++ b/src/monero/monero_zmq_publication.pyi @@ -0,0 +1,11 @@ +class MoneroZmqPublication: + """Models a publication of a daemon's zmq publisher.""" + + topic: str + """Publication topic.""" + json: str + """Publication content in JSON format.""" + + def __init__(self) -> None: + """Initialize a new publication.""" + ... diff --git a/src/monero/monero_zmq_subscriber.pyi b/src/monero/monero_zmq_subscriber.pyi new file mode 100644 index 00000000..7899ddce --- /dev/null +++ b/src/monero/monero_zmq_subscriber.pyi @@ -0,0 +1,23 @@ +from .monero_zmq_publication import MoneroZmqPublication + + +class MoneroZmqSubscriber: + """ + Receives the publications of a daemon's zmq publisher, can only be used by one thread at a time. + + Made by `MoneroRpcConnection.subscribe_zmq()`. It connects in the background and again if it loses the daemon, and a publication + that is made while it is not connected is lost. + """ + + def wait_for_publication(self, timeout_ms: int) -> MoneroZmqPublication | None: + """ + Wait for a publication. + + :param int timeout_ms: the maximum time to wait. + :returns MoneroZmqPublication | None: the publication, or `None` if there is none before the timeout. + """ + ... + + def discard_publications(self) -> None: + """Discard the publications which are pending.""" + ... diff --git a/tests/common/test_rpc_connection.py b/tests/common/test_rpc_connection.py index 99200133..7b181d92 100644 --- a/tests/common/test_rpc_connection.py +++ b/tests/common/test_rpc_connection.py @@ -6,7 +6,7 @@ from time import monotonic from typing import Any, Callable -from monero import MoneroRpcConnection, MoneroConnectionType, MoneroError, MoneroRpcError, MoneroUtils +from monero import MoneroRpcConnection, MoneroConnectionType, MoneroError, MoneroRpcError, MoneroUtils, MoneroZmqPublication, MoneroZmqSubscriber from utils import ( TestUtils as Utils, RpcConnectionUtils, StringUtils, BaseTestClass, FakeRawRpcServer @@ -162,6 +162,42 @@ def test_node_rpc_connection(self, node_connection: MoneroRpcConnection) -> None def test_wallet_rpc_connection(self, wallet_connection: MoneroRpcConnection) -> None: RpcConnectionUtils.test_rpc_connection(wallet_connection, Utils.WALLET_RPC_URI, True, MoneroConnectionType.IPV4) + # Can subscribe to the zmq publisher of the daemon + @pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled") + @pytest.mark.skipif(not Utils.DAEMON_RPC_ZMQ_PUB_URI, reason="daemon ZMQ publisher is not configured") + def test_subscribe_zmq(self) -> None: + connection: MoneroRpcConnection = MoneroRpcConnection( + Utils.DAEMON_RPC_URI, + Utils.DAEMON_RPC_USERNAME, + Utils.DAEMON_RPC_PASSWORD, + zmq_uri=Utils.DAEMON_RPC_ZMQ_PUB_URI + ) + subscriber: MoneroZmqSubscriber = connection.subscribe_zmq(["json-minimal-chain_main"]) + + # a publication is only there when a block was added meanwhile, and it is of the topic that was subscribed to + publication: MoneroZmqPublication | None = subscriber.wait_for_publication(100) + if publication is not None: + assert publication.topic == "json-minimal-chain_main" + assert publication.json + + subscriber.discard_publications() + + # Cannot subscribe to zmq without a zmq uri + @pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled") + def test_subscribe_zmq_without_zmq_uri(self) -> None: + connection: MoneroRpcConnection = MoneroRpcConnection("http://127.0.0.1:18081") + with pytest.raises(MoneroError, match="no zmq uri"): + connection.subscribe_zmq(["json-minimal-chain_main"]) + + # Cannot subscribe to zmq through a proxy, zmq would connect directly + @pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled") + def test_subscribe_zmq_through_proxy(self) -> None: + connection: MoneroRpcConnection = MoneroRpcConnection( + "http://127.0.0.1:18081", proxy_uri="127.0.0.1:9050", zmq_uri="tcp://127.0.0.1:18086" + ) + with pytest.raises(MoneroError, match="proxy"): + connection.subscribe_zmq(["json-minimal-chain_main"]) + # Test invalid connection @pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled") def test_invalid_connection(self) -> None: diff --git a/tests/utils/test_utils.py b/tests/utils/test_utils.py index f9098b28..7c23baca 100644 --- a/tests/utils/test_utils.py +++ b/tests/utils/test_utils.py @@ -301,7 +301,7 @@ def get_daemon_rpc(cls) -> MoneroDaemonRpc: """ if cls._DAEMON_RPC is None: - cls._DAEMON_RPC = MoneroDaemonRpc(cls.DAEMON_RPC_URI, cls.DAEMON_RPC_USERNAME, cls.DAEMON_RPC_PASSWORD) + cls._DAEMON_RPC = MoneroDaemonRpc(cls.get_daemon_rpc_connection()) return cls._DAEMON_RPC @@ -331,7 +331,12 @@ def get_daemon_rpc_connection(cls) -> MoneroRpcConnection: :returns MoneroRpcConnection: new test daemon rpc connection instance. """ - return MoneroRpcConnection(cls.DAEMON_RPC_URI, cls.DAEMON_RPC_USERNAME, cls.DAEMON_RPC_PASSWORD) + return MoneroRpcConnection( + cls.DAEMON_RPC_URI, + cls.DAEMON_RPC_USERNAME, + cls.DAEMON_RPC_PASSWORD, + zmq_uri=cls.DAEMON_RPC_ZMQ_PUB_URI + ) @classmethod def close_wallets(cls) -> None: