|
|
|
@ -22,7 +22,6 @@ use futures::{
|
|
|
|
|
};
|
|
|
|
|
use libp2p::PeerId;
|
|
|
|
|
use sha2::Sha256;
|
|
|
|
|
use std::sync::Arc;
|
|
|
|
|
use tokio::time::timeout;
|
|
|
|
|
|
|
|
|
|
// TODO(Franck): Use helper functions from xmr-btc instead of re-writing them
|
|
|
|
@ -52,7 +51,7 @@ pub async fn lock_xmr(
|
|
|
|
|
bob_peer_id: PeerId,
|
|
|
|
|
state3: alice::State3,
|
|
|
|
|
event_loop_handle: &mut EventLoopHandle,
|
|
|
|
|
monero_wallet: Arc<monero::Wallet>,
|
|
|
|
|
monero_wallet: &monero::Wallet,
|
|
|
|
|
) -> Result<()> {
|
|
|
|
|
let S_a = monero::PublicKey::from_private_key(&monero::PrivateKey { scalar: state3.s_a });
|
|
|
|
|
|
|
|
|
@ -126,14 +125,13 @@ pub async fn publish_cancel_transaction(
|
|
|
|
|
B: bitcoin::PublicKey,
|
|
|
|
|
cancel_timelock: CancelTimelock,
|
|
|
|
|
tx_cancel_sig_bob: bitcoin::Signature,
|
|
|
|
|
bitcoin_wallet: Arc<bitcoin::Wallet>,
|
|
|
|
|
bitcoin_wallet: &bitcoin::Wallet,
|
|
|
|
|
) -> Result<bitcoin::TxCancel> {
|
|
|
|
|
// First wait for cancel timelock to expire
|
|
|
|
|
let tx_lock_height = bitcoin_wallet
|
|
|
|
|
.transaction_block_height(tx_lock.txid())
|
|
|
|
|
.await?;
|
|
|
|
|
poll_until_block_height_is_gte(bitcoin_wallet.as_ref(), tx_lock_height + cancel_timelock)
|
|
|
|
|
.await?;
|
|
|
|
|
poll_until_block_height_is_gte(&bitcoin_wallet, tx_lock_height + cancel_timelock).await?;
|
|
|
|
|
|
|
|
|
|
let tx_cancel = bitcoin::TxCancel::new(&tx_lock, cancel_timelock, a.public(), B);
|
|
|
|
|
|
|
|
|
|