Do not introduced State6

This commit is contained in:
Franck Royer 2021-01-18 15:26:06 +11:00
parent 8615aaed6e
commit 9a823dca4c
No known key found for this signature in database
GPG key ID: A82ED75A8DFC50A4
4 changed files with 30 additions and 41 deletions

View file

@ -35,8 +35,12 @@ pub enum BobState {
CancelTimelockExpired(State4),
BtcCancelled(State4),
BtcRefunded(State4),
XmrRedeemed(State6),
BtcPunished(State6),
XmrRedeemed {
tx_lock_id: bitcoin::Txid,
},
BtcPunished {
tx_lock_id: bitcoin::Txid,
},
SafelyAborted,
}
@ -52,8 +56,8 @@ impl fmt::Display for BobState {
BobState::CancelTimelockExpired(..) => write!(f, "cancel timelock is expired"),
BobState::BtcCancelled(..) => write!(f, "btc is cancelled"),
BobState::BtcRefunded(..) => write!(f, "btc is refunded"),
BobState::XmrRedeemed(..) => write!(f, "xmr is redeemed"),
BobState::BtcPunished(..) => write!(f, "btc is punished"),
BobState::XmrRedeemed { .. } => write!(f, "xmr is redeemed"),
BobState::BtcPunished { .. } => write!(f, "btc is punished"),
BobState::SafelyAborted => write!(f, "safely aborted"),
}
}
@ -592,12 +596,6 @@ impl State4 {
pub fn tx_lock_id(&self) -> bitcoin::Txid {
self.tx_lock.txid()
}
pub fn state6(&self) -> State6 {
State6 {
tx_lock_id: self.tx_lock.txid(),
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
@ -650,21 +648,4 @@ impl State5 {
pub fn tx_lock_id(&self) -> bitcoin::Txid {
self.tx_lock.txid()
}
pub fn state6(&self) -> State6 {
State6 {
tx_lock_id: self.tx_lock.txid(),
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
pub struct State6 {
pub tx_lock_id: Txid,
}
impl State6 {
pub fn tx_lock_id(&self) -> bitcoin::Txid {
self.tx_lock_id
}
}