From 47a31760c02ec0c676baf5a14d075486f5671477 Mon Sep 17 00:00:00 2001 From: Daniel Karzel Date: Thu, 4 Mar 2021 13:54:13 +1100 Subject: [PATCH] Bob can verify the Monero txs by tx-hash Print tx-hashes for monero transactions to allow Bob to look the transaction up in block explorer. The story of Bab: Our famous actor Bob has a brother named Bab. In school they were often mixed up, because their names were so similar. Eventually Bab renamed himself into Barbara, but that was even more confusing for now he carried a female name even though he was not female. Bob wanted to help his brother and told him he could just go for Bub. But that did not solve anything. Fun fact: Bub is actually married to Alice. --- swap/src/monero/wallet.rs | 7 +++---- swap/src/protocol/bob/swap.rs | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/swap/src/monero/wallet.rs b/swap/src/monero/wallet.rs index 04fe14dd..65e5103e 100644 --- a/swap/src/monero/wallet.rs +++ b/swap/src/monero/wallet.rs @@ -194,10 +194,9 @@ impl Wallet { if proof.confirmations > confirmations.load(Ordering::SeqCst) { confirmations.store(proof.confirmations, Ordering::SeqCst); - info!( - "Monero lock tx received {} out of {} confirmations", - proof.confirmations, expected_confirmations - ); + + let txid = &transfer_proof.tx_hash.0; + info!(%txid, "Monero lock tx has {} out of {} confirmations", proof.confirmations, expected_confirmations); } if proof.confirmations < expected_confirmations { diff --git a/swap/src/protocol/bob/swap.rs b/swap/src/protocol/bob/swap.rs index 35b495de..8c3ef345 100644 --- a/swap/src/protocol/bob/swap.rs +++ b/swap/src/protocol/bob/swap.rs @@ -308,7 +308,11 @@ async fn run_until_internal( // Ensure that the generated wallet is synced so we have a proper balance monero_wallet.refresh().await?; // Sweep (transfer all funds) to the given address - monero_wallet.sweep_all(receive_monero_address).await?; + let tx_hashes = monero_wallet.sweep_all(receive_monero_address).await?; + + for tx_hash in tx_hashes { + tracing::info!("Sent XMR to {} in tx {}", receive_monero_address, tx_hash.0); + } let state = BobState::XmrRedeemed { tx_lock_id: state.tx_lock_id(),