Coverage for tests/wallet/test_update_locked.py: 100%
79 statements
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-22 19:49 +0000
« prev ^ index » next coverage.py v7.17.3, created at 2026-11-22 19:49 +0000
1from __future__ import annotations
3import logging
5import pytest
6from monero import MoneroDaemonRpc, MoneroTxConfig, MoneroWallet
7from typing_extensions import override
9from utils import TestUtils, TxWalletUtils, WalletSendUtils
10from .base_test_monero_wallet import BaseTestMoneroWallet
11from .wallet_support import FullWalletSupport, RpcWalletSupport, KeysWalletSupport
13logger: logging.Logger = logging.getLogger("TestMoneroWalletUpdateLocked")
16class BaseTestMoneroWalletUpdateLocked(BaseTestMoneroWallet):
17 """Common wallet update locked tests."""
19 # TODO: test sending to multiple accounts
20 # Can update a locked tx sent from/to the same account as blocks are added to the chain
21 @pytest.mark.skipif(TestUtils.TEST_RELAYS is False, reason="TEST_RELAYS disabled")
22 @pytest.mark.skipif(TestUtils.TEST_NOTIFICATIONS is False, reason="TEST_NOTIFICATIONS disabled")
23 @pytest.mark.flaky(reruns=5, reruns_delay=10, only_rerun=["Daemon is busy", r"Cannot reconcile integrals:.*m_is_incoming"])
24 def test_update_locked_same_account(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
25 config: MoneroTxConfig = MoneroTxConfig()
26 config.address = wallet.get_primary_address()
27 config.amount = TxWalletUtils.MAX_FEE
28 config.account_index = 0
29 config.can_split = False
30 config.relay = True
31 WalletSendUtils.test_send_and_update_txs(daemon, wallet, config)
33 # Can update split locked txs sent from/to the same account as blocks are added to the chain
34 @pytest.mark.skipif(TestUtils.TEST_RELAYS is False, reason="TEST_RELAYS disabled")
35 @pytest.mark.skipif(TestUtils.TEST_NOTIFICATIONS is False, reason="TEST_NOTIFICATIONS disabled")
36 @pytest.mark.skipif(TestUtils.LITE_MODE, reason="LITE_MODE enabled")
37 @pytest.mark.flaky(reruns=5, reruns_delay=10, only_rerun=["Daemon is busy", r"Cannot reconcile integrals:.*m_is_incoming"])
38 def test_update_locked_same_account_split(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
39 config: MoneroTxConfig = MoneroTxConfig()
40 config.address = wallet.get_primary_address()
41 config.amount = TxWalletUtils.MAX_FEE
42 config.account_index = 0
43 config.can_split = True
44 config.relay = True
45 WalletSendUtils.test_send_and_update_txs(daemon, wallet, config)
47 # TODO on wallet full is flaky due to `Cannot reconcile integrals: 0 vs 1. tx wallet m_is_incoming` error
48 # Can update a locked tx sent from/to different accounts as blocks are added to the chain
49 @pytest.mark.skipif(TestUtils.TEST_RELAYS is False, reason="TEST_RELAYS disabled")
50 @pytest.mark.skipif(TestUtils.TEST_NOTIFICATIONS is False, reason="TEST_NOTIFICATIONS disabled")
51 @pytest.mark.skipif(TestUtils.LITE_MODE, reason="LITE_MODE enabled")
52 @pytest.mark.flaky(reruns=5, reruns_delay=10, only_rerun=["Daemon is busy", r"Cannot reconcile integrals:.*m_is_incoming"])
53 def test_update_locked_different_accounts(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
54 config: MoneroTxConfig = MoneroTxConfig()
55 config.address = wallet.get_subaddress(1, 0).address
56 config.amount = TxWalletUtils.MAX_FEE
57 config.account_index = 0
58 config.can_split = False
59 config.relay = True
60 WalletSendUtils.test_send_and_update_txs(daemon, wallet, config)
62 # Can update locked, split txs sent from/to different accounts as blocks are added to the chain
63 @pytest.mark.skipif(TestUtils.TEST_RELAYS is False, reason="TEST_RELAYS disabled")
64 @pytest.mark.skipif(TestUtils.TEST_NOTIFICATIONS is False, reason="TEST_NOTIFICATIONS disabled")
65 @pytest.mark.skipif(TestUtils.LITE_MODE, reason="LITE_MODE enabled")
66 @pytest.mark.flaky(reruns=5, reruns_delay=10, only_rerun=["Daemon is busy", r"Cannot reconcile integrals:.*m_is_incoming"])
67 def test_update_locked_different_accounts_split(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
68 config: MoneroTxConfig = MoneroTxConfig()
69 config.address = wallet.get_subaddress(1, 0).address
70 config.amount = TxWalletUtils.MAX_FEE
71 config.account_index = 0
72 config.can_split = True
73 config.relay = True
74 WalletSendUtils.test_send_and_update_txs(daemon, wallet, config)
77@pytest.mark.integration
78class TestMoneroWalletFullUpdateLocked(FullWalletSupport, BaseTestMoneroWalletUpdateLocked):
79 """Full wallet update locked integration tests."""
82@pytest.mark.integration
83class TestMoneroWalletRpcUpdateLocked(RpcWalletSupport, BaseTestMoneroWalletUpdateLocked):
84 """Rpc wallet update locked integration tests."""
87@pytest.mark.unit
88class TestMoneroWalletKeysUpdateLocked(KeysWalletSupport, BaseTestMoneroWalletUpdateLocked):
89 """Keys-only wallet update locked unit tests."""
91 @pytest.mark.not_supported
92 @override
93 def test_update_locked_same_account(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
94 return super().test_update_locked_same_account(daemon, wallet)
96 @pytest.mark.not_supported
97 @override
98 def test_update_locked_same_account_split(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
99 return super().test_update_locked_same_account_split(daemon, wallet)
101 @pytest.mark.not_supported
102 @override
103 def test_update_locked_different_accounts(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
104 return super().test_update_locked_different_accounts(daemon, wallet)
106 @pytest.mark.not_supported
107 @override
108 def test_update_locked_different_accounts_split(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None:
109 return super().test_update_locked_different_accounts_split(daemon, wallet)