Rename EncSign to EncSig

`EncSig` means "encrypted signature", the item,
not be confused with "signing", the action
This commit is contained in:
Franck Royer 2020-12-22 14:53:21 +11:00
parent 9c83ca52ad
commit 405e377f79
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
3 changed files with 14 additions and 14 deletions

View File

@ -60,7 +60,7 @@ pub enum AliceState {
XmrLocked {
state3: State3,
},
EncSignLearned {
EncSigLearned {
state3: State3,
encrypted_signature: EncryptedSignature,
},
@ -92,7 +92,7 @@ impl fmt::Display for AliceState {
AliceState::Negotiated { .. } => write!(f, "negotiated"),
AliceState::BtcLocked { .. } => write!(f, "btc_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::BtcCancelled { .. } => write!(f, "btc_cancelled"),
AliceState::BtcRefunded { .. } => write!(f, "btc_refunded"),
@ -111,10 +111,10 @@ impl From<&AliceState> for state::Alice {
AliceState::Negotiated { state3, .. } => Alice::Negotiated(state3.clone()),
AliceState::BtcLocked { state3, .. } => Alice::BtcLocked(state3.clone()),
AliceState::XmrLocked { state3 } => Alice::XmrLocked(state3.clone()),
AliceState::EncSignLearned {
AliceState::EncSigLearned {
state3,
encrypted_signature,
} => Alice::EncSignLearned {
encrypted_signature,,
} => Alice::EncSigLearned {
state: state3.clone(),
encrypted_signature: encrypted_signature.clone(),
},
@ -159,10 +159,10 @@ impl TryFrom<state::Swap> for AliceState {
},
Alice::XmrLocked(state3) => XmrLocked { state3 },
Alice::BtcRedeemable { .. } => bail!("BtcRedeemable state is unexpected"),
Alice::EncSignLearned {
Alice::EncSigLearned {
state,
encrypted_signature,
} => EncSignLearned {
} => EncSigLearned {
state3: state,
encrypted_signature,
},
@ -253,7 +253,7 @@ pub fn is_xmr_locked(state: &AliceState) -> bool {
pub fn is_encsig_learned(state: &AliceState) -> bool {
matches!(
state,
AliceState::EncSignLearned{..}
AliceState::EncSigLearned{..}
)
}
@ -401,7 +401,7 @@ pub async fn run_until(
match select(t1_timeout, wait_for_enc_sig).await {
Either::Left(_) => AliceState::T1Expired { state3 },
Either::Right((enc_sig, _)) => AliceState::EncSignLearned {
Either::Right((enc_sig, _)) => AliceState::EncSigLearned {
state3,
encrypted_signature: enc_sig?,
},
@ -425,7 +425,7 @@ pub async fn run_until(
)
.await
}
AliceState::EncSignLearned {
AliceState::EncSigLearned {
state3,
encrypted_signature,
} => {

View File

@ -20,7 +20,7 @@ pub enum Alice {
state: alice::State3,
redeem_tx: bitcoin::Transaction,
},
EncSignLearned {
EncSigLearned {
state: alice::State3,
encrypted_signature: EncryptedSignature,
},
@ -81,7 +81,7 @@ impl Display for Alice {
Alice::BtcPunishable(_) => f.write_str("Bitcoin punishable"),
Alice::BtcRefunded { .. } => f.write_str("Monero refundable"),
Alice::SwapComplete => f.write_str("Swap complete"),
Alice::EncSignLearned { .. } => f.write_str("Encrypted signature learned"),
Alice::EncSigLearned { .. } => f.write_str("Encrypted signature learned"),
}
}
}

View File

@ -108,13 +108,13 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
.await
.unwrap();
assert!(matches!(alice_state, AliceState::EncSignLearned {..}));
assert!(matches!(alice_state, AliceState::EncSigLearned {..}));
let alice_db = Database::open(alice_db_datadir.path()).unwrap();
let state_before_restart = alice_db.get_state(alice_swap_id).unwrap();
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) =