Skip to content

Commit 0184106

Browse files
integration tests: test wallet rpc set pool period
* fix monero_wallet_rpc::get_subaddress binding
1 parent 83aeeb9 commit 0184106

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎src/cpp/wallet/py_monero_wallet_bindings.cpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,12 @@ void py_monero_bind_wallet(py::module_& m, PyMoneroTypes& t) {
11341134
.def("get_rpc_connection", [](monero_wallet_rpc& self) {
11351135
MONERO_CATCH_AND_RETHROW(self.get_rpc_connection());
11361136
}, py::call_guard<py::gil_scoped_release>())
1137+
.def("set_poll_period_in_ms", [](monero_wallet_rpc& self, uint64_t period_ms) {
1138+
MONERO_CATCH_AND_RETHROW(self.set_poll_period_in_ms(period_ms));
1139+
}, py::arg("period_ms"), py::call_guard<py::gil_scoped_release>())
1140+
.def("get_subaddress", [](monero_wallet_rpc& self, uint32_t account_idx, uint32_t subaddress_idx) {
1141+
MONERO_CATCH_AND_RETHROW(self.get_subaddress(account_idx, subaddress_idx));
1142+
}, py::arg("account_idx"), py::arg("subaddress_idx"), py::call_guard<py::gil_scoped_release>())
11371143
// this because of function hiding
11381144
.def("set_daemon_connection", [](PyMoneroWallet& self, const std::shared_ptr<monero_rpc_connection>& connection, const boost::optional<bool>& is_trusted) {
11391145
MONERO_CATCH_AND_RETHROW(self.set_daemon_connection(connection, is_trusted));

‎src/python/monero_wallet_rpc.pyi‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ class MoneroWalletRpc(MoneroWallet):
7575
"""Save and close the current wallet and stop the RPC server."""
7676
...
7777

78+
def set_poll_period_in_ms(self, period_ms: int) -> None:
79+
"""
80+
Set the period between polls of the wallet for notifications.
81+
82+
:param int period_ms: the poll period in milliseconds.
83+
"""
84+
...
85+
7886
def get_seed_languages(self) -> list[str]:
7987
"""
8088
Get all supported wallet seed languages.

‎tests/test_monero_wallet_rpc.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ def test_sync_progress(self, wallet: MoneroWalletRpc) -> None:
105105
wallet.sync(0, listener)
106106
assert str(exc_info.value) == ERR_MSG
107107

108+
# Can set the poll period for wallet notifications
109+
@pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled")
110+
def test_set_poll_period_in_ms(self, wallet: MoneroWalletRpc) -> None:
111+
try:
112+
wallet.set_poll_period_in_ms(1000)
113+
finally:
114+
# restore the configured period so later tests poll at the expected rate
115+
wallet.set_poll_period_in_ms(Utils.SYNC_PERIOD_IN_MS)
116+
108117
@pytest.mark.skipif(Utils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled")
109118
@override
110119
def test_get_subaddress_address_out_of_range(self, wallet: MoneroWallet) -> None:

0 commit comments

Comments
 (0)