mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Rename EncSign
to EncSig
`EncSig` means "encrypted signature", the item, not be confused with "signing", the action
This commit is contained in:
parent
9c83ca52ad
commit
405e377f79
@ -60,7 +60,7 @@ pub enum AliceState {
|
|||||||
XmrLocked {
|
XmrLocked {
|
||||||
state3: State3,
|
state3: State3,
|
||||||
},
|
},
|
||||||
EncSignLearned {
|
EncSigLearned {
|
||||||
state3: State3,
|
state3: State3,
|
||||||
encrypted_signature: EncryptedSignature,
|
encrypted_signature: EncryptedSignature,
|
||||||
},
|
},
|
||||||
@ -92,7 +92,7 @@ impl fmt::Display for AliceState {
|
|||||||
AliceState::Negotiated { .. } => write!(f, "negotiated"),
|
AliceState::Negotiated { .. } => write!(f, "negotiated"),
|
||||||
AliceState::BtcLocked { .. } => write!(f, "btc_locked"),
|
AliceState::BtcLocked { .. } => write!(f, "btc_locked"),
|
||||||
AliceState::XmrLocked { .. } => write!(f, "xmr_locked"),
|
AliceState::XmrLocked { .. } => write!(f, "xmr_locked"),
|
||||||
AliceState::EncSignLearned { .. } => write!(f, "encsig_learned"),
|
AliceState::EncSigLearned { .. } => write!(f, "encsig_learned"),
|
||||||
AliceState::BtcRedeemed => write!(f, "btc_redeemed"),
|
AliceState::BtcRedeemed => write!(f, "btc_redeemed"),
|
||||||
AliceState::BtcCancelled { .. } => write!(f, "btc_cancelled"),
|
AliceState::BtcCancelled { .. } => write!(f, "btc_cancelled"),
|
||||||
AliceState::BtcRefunded { .. } => write!(f, "btc_refunded"),
|
AliceState::BtcRefunded { .. } => write!(f, "btc_refunded"),
|
||||||
@ -111,10 +111,10 @@ impl From<&AliceState> for state::Alice {
|
|||||||
AliceState::Negotiated { state3, .. } => Alice::Negotiated(state3.clone()),
|
AliceState::Negotiated { state3, .. } => Alice::Negotiated(state3.clone()),
|
||||||
AliceState::BtcLocked { state3, .. } => Alice::BtcLocked(state3.clone()),
|
AliceState::BtcLocked { state3, .. } => Alice::BtcLocked(state3.clone()),
|
||||||
AliceState::XmrLocked { state3 } => Alice::XmrLocked(state3.clone()),
|
AliceState::XmrLocked { state3 } => Alice::XmrLocked(state3.clone()),
|
||||||
AliceState::EncSignLearned {
|
AliceState::EncSigLearned {
|
||||||
state3,
|
state3,
|
||||||
encrypted_signature,
|
encrypted_signature,,
|
||||||
} => Alice::EncSignLearned {
|
} => Alice::EncSigLearned {
|
||||||
state: state3.clone(),
|
state: state3.clone(),
|
||||||
encrypted_signature: encrypted_signature.clone(),
|
encrypted_signature: encrypted_signature.clone(),
|
||||||
},
|
},
|
||||||
@ -159,10 +159,10 @@ impl TryFrom<state::Swap> for AliceState {
|
|||||||
},
|
},
|
||||||
Alice::XmrLocked(state3) => XmrLocked { state3 },
|
Alice::XmrLocked(state3) => XmrLocked { state3 },
|
||||||
Alice::BtcRedeemable { .. } => bail!("BtcRedeemable state is unexpected"),
|
Alice::BtcRedeemable { .. } => bail!("BtcRedeemable state is unexpected"),
|
||||||
Alice::EncSignLearned {
|
Alice::EncSigLearned {
|
||||||
state,
|
state,
|
||||||
encrypted_signature,
|
encrypted_signature,
|
||||||
} => EncSignLearned {
|
} => EncSigLearned {
|
||||||
state3: state,
|
state3: state,
|
||||||
encrypted_signature,
|
encrypted_signature,
|
||||||
},
|
},
|
||||||
@ -253,7 +253,7 @@ pub fn is_xmr_locked(state: &AliceState) -> bool {
|
|||||||
pub fn is_encsig_learned(state: &AliceState) -> bool {
|
pub fn is_encsig_learned(state: &AliceState) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
state,
|
state,
|
||||||
AliceState::EncSignLearned{..}
|
AliceState::EncSigLearned{..}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ pub async fn run_until(
|
|||||||
|
|
||||||
match select(t1_timeout, wait_for_enc_sig).await {
|
match select(t1_timeout, wait_for_enc_sig).await {
|
||||||
Either::Left(_) => AliceState::T1Expired { state3 },
|
Either::Left(_) => AliceState::T1Expired { state3 },
|
||||||
Either::Right((enc_sig, _)) => AliceState::EncSignLearned {
|
Either::Right((enc_sig, _)) => AliceState::EncSigLearned {
|
||||||
state3,
|
state3,
|
||||||
encrypted_signature: enc_sig?,
|
encrypted_signature: enc_sig?,
|
||||||
},
|
},
|
||||||
@ -425,7 +425,7 @@ pub async fn run_until(
|
|||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
AliceState::EncSignLearned {
|
AliceState::EncSigLearned {
|
||||||
state3,
|
state3,
|
||||||
encrypted_signature,
|
encrypted_signature,
|
||||||
} => {
|
} => {
|
||||||
|
@ -20,7 +20,7 @@ pub enum Alice {
|
|||||||
state: alice::State3,
|
state: alice::State3,
|
||||||
redeem_tx: bitcoin::Transaction,
|
redeem_tx: bitcoin::Transaction,
|
||||||
},
|
},
|
||||||
EncSignLearned {
|
EncSigLearned {
|
||||||
state: alice::State3,
|
state: alice::State3,
|
||||||
encrypted_signature: EncryptedSignature,
|
encrypted_signature: EncryptedSignature,
|
||||||
},
|
},
|
||||||
@ -81,7 +81,7 @@ impl Display for Alice {
|
|||||||
Alice::BtcPunishable(_) => f.write_str("Bitcoin punishable"),
|
Alice::BtcPunishable(_) => f.write_str("Bitcoin punishable"),
|
||||||
Alice::BtcRefunded { .. } => f.write_str("Monero refundable"),
|
Alice::BtcRefunded { .. } => f.write_str("Monero refundable"),
|
||||||
Alice::SwapComplete => f.write_str("Swap complete"),
|
Alice::SwapComplete => f.write_str("Swap complete"),
|
||||||
Alice::EncSignLearned { .. } => f.write_str("Encrypted signature learned"),
|
Alice::EncSigLearned { .. } => f.write_str("Encrypted signature learned"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,13 +108,13 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert!(matches!(alice_state, AliceState::EncSignLearned {..}));
|
assert!(matches!(alice_state, AliceState::EncSigLearned {..}));
|
||||||
|
|
||||||
let alice_db = Database::open(alice_db_datadir.path()).unwrap();
|
let alice_db = Database::open(alice_db_datadir.path()).unwrap();
|
||||||
let state_before_restart = alice_db.get_state(alice_swap_id).unwrap();
|
let state_before_restart = alice_db.get_state(alice_swap_id).unwrap();
|
||||||
|
|
||||||
if let swap::state::Swap::Alice(state) = state_before_restart.clone() {
|
if let swap::state::Swap::Alice(state) = state_before_restart.clone() {
|
||||||
assert!(matches!(state, swap::state::Alice::EncSignLearned {..}));
|
assert!(matches!(state, swap::state::Alice::EncSigLearned {..}));
|
||||||
}
|
}
|
||||||
|
|
||||||
let (mut event_loop_after_restart, event_loop_handle_after_restart) =
|
let (mut event_loop_after_restart, event_loop_handle_after_restart) =
|
||||||
|
Loading…
Reference in New Issue
Block a user