Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- ASB+GUI: Skip publishing the Monero redeem/refund transaction if it is already present on chain (e.g. after a restart)

## [4.8.4] - 2026-06-09

## [4.8.3] - 2026-06-08
Expand Down
14 changes: 14 additions & 0 deletions monero-wallet/src/wallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,20 @@ impl Wallets {
rpc_client
}

pub async fn is_transaction_present(&self, tx_hash: &TxHash) -> Result<bool> {
use monero_wallet_ng::rpc::{ProvidesTransactionStatus, TransactionStatus};

let rpc_client = self.rpc_client().await;
let tx_id = tx_hash_to_bytes(tx_hash)?;

let status = rpc_client
.transaction_status(tx_id)
.await
.context("Failed to query Monero transaction status")?;

Ok(!matches!(status, TransactionStatus::Unknown))
}

pub async fn direct_rpc_block_height(&self) -> Result<u64> {
use monero_daemon_rpc::prelude::ProvidesBlockchainMeta;
let rpc_client = self.rpc_client().await;
Expand Down
11 changes: 11 additions & 0 deletions swap/src/protocol/alice/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,17 @@ where
retry(
"Publishing Monero refund transaction",
|| async {
let is_present = monero_wallet
.is_transaction_present(&xmr_refund_tx_hash)
.await
.context("Failed to check whether Monero refund transaction is already present on chain")
.map_err(backoff::Error::transient)?;

if is_present {
tracing::info!(%swap_id, %xmr_refund_tx_hash, "Monero refund transaction is already present on chain, skipping publish");
return Ok(());
}

monero_wallet
.rpc_client()
.await
Expand Down
11 changes: 11 additions & 0 deletions swap/src/protocol/bob/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,17 @@ async fn next_state(
retry(
"Publishing Monero redeem transaction",
|| async {
let is_present = monero_wallet
.is_transaction_present(&xmr_redeem_tx_hash)
.await
.context("Failed to check whether Monero redeem transaction is already present on chain")
.map_err(backoff::Error::transient)?;

if is_present {
tracing::info!(%swap_id, %xmr_redeem_tx_hash, "Monero redeem transaction is already present on chain, skipping publish");
return Ok(());
}

monero_wallet
.rpc_client()
.await
Expand Down
Loading