|
|
@ -56,6 +56,8 @@ pub async fn new( |
|
|
|
.try_into_msg0() |
|
|
|
.context("Failed to read Msg0")?; |
|
|
|
|
|
|
|
tracing::info!("Exchanged setup parameters"); |
|
|
|
|
|
|
|
let (other, other_punish) = msg0.into(); |
|
|
|
|
|
|
|
let params = AllParams::new(own_params, own_punish, other, other_punish, role); |
|
|
@ -86,6 +88,8 @@ pub async fn new( |
|
|
|
) |
|
|
|
.context("Failed to create CFD transactions")?; |
|
|
|
|
|
|
|
tracing::info!("Created CFD transactions"); |
|
|
|
|
|
|
|
sink.send(SetupMsg::Msg1(Msg1::from(own_cfd_txs.clone()))) |
|
|
|
.await |
|
|
|
.context("Failed to send Msg1")?; |
|
|
@ -96,6 +100,8 @@ pub async fn new( |
|
|
|
.try_into_msg1() |
|
|
|
.context("Failed to read Msg1")?; |
|
|
|
|
|
|
|
tracing::info!("Exchanged CFD transactions"); |
|
|
|
|
|
|
|
let lock_desc = lock_descriptor(params.maker().identity_pk, params.taker().identity_pk); |
|
|
|
|
|
|
|
let lock_amount = params.maker().lock_amount + params.taker().lock_amount; |
|
|
@ -157,6 +163,8 @@ pub async fn new( |
|
|
|
) |
|
|
|
.context("Refund signature does not verify")?; |
|
|
|
|
|
|
|
tracing::info!("Verified all signatures"); |
|
|
|
|
|
|
|
let mut signed_lock_tx = wallet.sign(lock_tx).await?; |
|
|
|
sink.send(SetupMsg::Msg2(Msg2 { |
|
|
|
signed_lock: signed_lock_tx.clone(), |
|
|
@ -212,6 +220,8 @@ pub async fn new( |
|
|
|
}) |
|
|
|
.collect::<Result<HashMap<_, _>>>()?; |
|
|
|
|
|
|
|
tracing::info!("Exchanged signed lock transaction"); |
|
|
|
|
|
|
|
Ok(Dlc { |
|
|
|
identity: sk, |
|
|
|
identity_counterparty: params.other.identity_pk, |
|
|
|