|
16 | 16 | MoneroOutputQuery, MoneroTransfer, MoneroIncomingTransfer, MoneroOutgoingTransfer, |
17 | 17 | MoneroTxWallet, MoneroOutputWallet, MoneroTx, MoneroAccount, MoneroSubaddress, |
18 | 18 | MoneroMessageSignatureType, MoneroTxPriority, MoneroFeeEstimate, |
19 | | - MoneroIntegratedAddress, MoneroCheckTx, MoneroCheckReserve |
| 19 | + MoneroIntegratedAddress, MoneroCheckTx, MoneroCheckReserve, MoneroSubmitTxResult |
20 | 20 | ) |
21 | 21 | from utils import ( |
22 | 22 | TestUtils, WalletEqualityUtils, |
@@ -3318,6 +3318,57 @@ def test_input_key_images(self, wallet: MoneroWallet) -> None: |
3318 | 3318 | assert max_skipped_output.amount is not None |
3319 | 3319 | assert max_skipped_output.amount < TxUtils.MAX_FEE |
3320 | 3320 |
|
| 3321 | + # Can prove unrelayed txs |
| 3322 | + @pytest.mark.skipif(TestUtils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled") |
| 3323 | + def test_prove_unrelayed_txs(self, daemon: MoneroDaemonRpc, wallet: MoneroWallet) -> None: |
| 3324 | + # create unrelayed tx to verify |
| 3325 | + address1: str = WalletUtils.get_external_wallet_address() |
| 3326 | + address2: str = wallet.get_address(0, 0) |
| 3327 | + address3: str = wallet.get_address(1, 0) |
| 3328 | + tx_config: MoneroTxConfig = MoneroTxConfig() |
| 3329 | + tx_config.account_index = 0 |
| 3330 | + tx_config.destinations.append(MoneroDestination(address1, TxUtils.MAX_FEE)) |
| 3331 | + tx_config.destinations.append(MoneroDestination(address2, TxUtils.MAX_FEE * 2)) |
| 3332 | + tx_config.destinations.append(MoneroDestination(address3, TxUtils.MAX_FEE * 3)) |
| 3333 | + tx: MoneroTxWallet = wallet.create_tx(tx_config) |
| 3334 | + assert tx.full_hex is not None |
| 3335 | + assert tx.hash is not None |
| 3336 | + assert tx.key is not None |
| 3337 | + |
| 3338 | + # submit tx to daemon but do not relay |
| 3339 | + result: MoneroSubmitTxResult = daemon.submit_tx_hex(tx.full_hex, True) |
| 3340 | + assert result.is_good |
| 3341 | + |
| 3342 | + # create random wallet to verify transfers |
| 3343 | + verifying_wallet: MoneroWallet = self._create_wallet(MoneroWalletConfig()) |
| 3344 | + |
| 3345 | + # verify transfer 1 |
| 3346 | + check: MoneroCheckTx = verifying_wallet.check_tx_key(tx.hash, tx.key, address1) |
| 3347 | + assert check.is_good |
| 3348 | + assert check.in_tx_pool is True |
| 3349 | + assert check.num_confirmations == 0 |
| 3350 | + assert check.received_amount == TxUtils.MAX_FEE |
| 3351 | + |
| 3352 | + # verify transfer 2 |
| 3353 | + check = verifying_wallet.check_tx_key(tx.hash, tx.key, address2) |
| 3354 | + assert check.is_good |
| 3355 | + assert check.in_tx_pool is True |
| 3356 | + assert check.num_confirmations == 0 |
| 3357 | + # + change amount |
| 3358 | + assert check.received_amount is not None |
| 3359 | + assert check.received_amount >= TxUtils.MAX_FEE * 2 |
| 3360 | + |
| 3361 | + # verify transfer 3 |
| 3362 | + check = verifying_wallet.check_tx_key(tx.hash, tx.key, address3) |
| 3363 | + assert check.is_good |
| 3364 | + assert check.in_tx_pool is True |
| 3365 | + assert check.num_confirmations == 0 |
| 3366 | + assert TxUtils.MAX_FEE * 3 == check.received_amount |
| 3367 | + |
| 3368 | + # cleanup |
| 3369 | + daemon.flush_tx_pool(tx.hash) |
| 3370 | + self._close_wallet(verifying_wallet) |
| 3371 | + |
3321 | 3372 | # Can get the default fee priority |
3322 | 3373 | @pytest.mark.skipif(TestUtils.TEST_NON_RELAYS is False, reason="TEST_NON_RELAYS disabled") |
3323 | 3374 | def test_get_default_fee_priority(self, wallet: MoneroWallet) -> None: |
|
0 commit comments