Prevent premature Bob t1 timeout

Bob was hitting the t1 timeout and entering cancel
instead of redeem. This was resolved by increasing
the timeouts to 50.
This commit is contained in:
rishflab 2020-12-10 11:51:58 +11:00
parent 27d1334726
commit f5d3d54b13
4 changed files with 8 additions and 20 deletions

View file

@ -13,7 +13,7 @@ use libp2p::request_response::ResponseChannel;
use sha2::Sha256; use sha2::Sha256;
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use tokio::time::timeout; use tokio::time::timeout;
use tracing::trace; use tracing::{info, trace};
use xmr_btc::{ use xmr_btc::{
alice, alice,
alice::State3, alice::State3,
@ -183,6 +183,7 @@ pub async fn publish_bitcoin_redeem_transaction<W>(
where where
W: BroadcastSignedTransaction + WaitForTransactionFinality, W: BroadcastSignedTransaction + WaitForTransactionFinality,
{ {
info!("Attempting to publish bitcoin redeem txn");
let tx_id = bitcoin_wallet let tx_id = bitcoin_wallet
.broadcast_signed_transaction(redeem_tx) .broadcast_signed_transaction(redeem_tx)
.await?; .await?;

View file

@ -271,22 +271,10 @@ where
// } // }
Ok(BobState::BtcRefunded) Ok(BobState::BtcRefunded)
} }
BobState::BtcRefunded => { BobState::BtcRefunded => Ok(BobState::BtcRefunded),
info!("btc refunded"); BobState::Punished => Ok(BobState::Punished),
Ok(BobState::BtcRefunded) BobState::SafelyAborted => Ok(BobState::SafelyAborted),
} BobState::XmrRedeemed => Ok(BobState::XmrRedeemed),
BobState::Punished => {
info!("punished");
Ok(BobState::Punished)
}
BobState::SafelyAborted => {
info!("safely aborted");
Ok(BobState::SafelyAborted)
}
BobState::XmrRedeemed => {
info!("xmr redeemed");
Ok(BobState::XmrRedeemed)
}
} }
} }
} }

View file

@ -14,8 +14,8 @@ pub mod state;
pub mod storage; pub mod storage;
pub mod tor; pub mod tor;
pub const REFUND_TIMELOCK: u32 = 10; // Relative timelock, this is number of blocks. TODO: What should it be? pub const REFUND_TIMELOCK: u32 = 50; // Relative timelock, this is number of blocks. TODO: What should it be?
pub const PUNISH_TIMELOCK: u32 = 10; // FIXME: What should this be? pub const PUNISH_TIMELOCK: u32 = 50; // FIXME: What should this be?
pub type Never = std::convert::Infallible; pub type Never = std::convert::Infallible;

View file

@ -10,7 +10,6 @@ use swap::{
}; };
use tempfile::tempdir; use tempfile::tempdir;
use testcontainers::clients::Cli; use testcontainers::clients::Cli;
use tracing_subscriber::util::SubscriberInitExt as _;
use uuid::Uuid; use uuid::Uuid;
use xmr_btc::{alice::State0, bitcoin, config::Config, cross_curve_dleq}; use xmr_btc::{alice::State0, bitcoin, config::Config, cross_curve_dleq};