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

View File

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

View File

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

View File

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