Browse Source

Merge #250

250: Roll over bug fixes r=bonomat a=bonomat

With these bugs fixed we get all the way back into `Open` state :)

Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
compile-for-aarch64
bors[bot] 3 years ago
committed by GitHub
parent
commit
98ae67f827
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      daemon/src/model/cfd.rs
  2. 2
      daemon/src/monitor.rs
  3. 4
      daemon/src/setup_contract.rs
  4. 2
      daemon/src/taker_cfd.rs

11
daemon/src/model/cfd.rs

@ -526,6 +526,17 @@ impl Cfd {
dlc,
attestation: None,
}
} else if let Open {
dlc, attestation, ..
} = self.state.clone()
{
CfdState::Open {
common: CfdStateCommon {
transition_timestamp: SystemTime::now(),
},
dlc,
attestation,
}
} else {
bail!(
"Cannot transition to Open because of unexpected state {}",

2
daemon/src/monitor.rs

@ -244,7 +244,7 @@ where
.entry((revoked_commit_tx.0, revoked_commit_tx.1.clone()))
.or_default()
.push((
ScriptStatus::with_confirmations(0),
ScriptStatus::InMempool,
Event::RevokedTransactionFound(order_id),
));
}

4
daemon/src/setup_contract.rs

@ -314,13 +314,13 @@ pub async fn roll_over(
let own_cfd_txs = renew_cfd_transactions(
lock_tx.clone(),
(
pk,
maker_identity,
maker_lock_amount,
dlc.maker_address.clone(),
maker_punish_params,
),
(
dlc.identity_counterparty,
taker_identity,
taker_lock_amount,
dlc.taker_address.clone(),
taker_punish_params,

2
daemon/src/taker_cfd.rs

@ -407,6 +407,8 @@ impl Actor {
.await
});
self.remove_pending_proposal(&order_id)
.context("Could not remove accepted roll over")?;
Ok(())
}

Loading…
Cancel
Save