Browse Source
Pass on attestation upon `CommitFinality`
We have to properly pass on the attestation when transitioning from `PendingOpen`, `Open` or `PendingCommit` to `OpenCommitted`.
temporary-fast-timelocks
Daniel Karzel
3 years ago
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E
1 changed files with
18 additions and
5 deletions
-
daemon/src/model/cfd.rs
|
|
@ -581,11 +581,20 @@ impl Cfd { |
|
|
|
} |
|
|
|
} |
|
|
|
monitor::Event::CommitFinality(_) => { |
|
|
|
let dlc = if let PendingCommit { dlc, .. } = self.state.clone() { |
|
|
|
dlc |
|
|
|
} else if let PendingOpen { dlc, .. } | Open { dlc, .. } = self.state.clone() { |
|
|
|
let (dlc, attestation) = if let PendingCommit { |
|
|
|
dlc, attestation, .. |
|
|
|
} = self.state.clone() |
|
|
|
{ |
|
|
|
(dlc, attestation) |
|
|
|
} else if let PendingOpen { |
|
|
|
dlc, attestation, .. |
|
|
|
} |
|
|
|
| Open { |
|
|
|
dlc, attestation, .. |
|
|
|
} = self.state.clone() |
|
|
|
{ |
|
|
|
tracing::debug!(%order_id, "Was in unexpected state {}, jumping ahead to OpenCommitted", self.state); |
|
|
|
dlc |
|
|
|
(dlc, attestation) |
|
|
|
} else { |
|
|
|
bail!( |
|
|
|
"Cannot transition to OpenCommitted because of unexpected state {}", |
|
|
@ -598,7 +607,11 @@ impl Cfd { |
|
|
|
transition_timestamp: SystemTime::now(), |
|
|
|
}, |
|
|
|
dlc, |
|
|
|
cet_status: CetStatus::Unprepared, |
|
|
|
cet_status: if let Some(attestation) = attestation { |
|
|
|
CetStatus::OracleSigned(attestation) |
|
|
|
} else { |
|
|
|
CetStatus::Unprepared |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
monitor::Event::CetTimelockExpired(_) => match self.state.clone() { |
|
|
|