mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-23 14:39:37 -05:00
Upgrade toolchain
Needed to use libp2p-async-await
This commit is contained in:
parent
e82383bcf6
commit
c316ea5244
@ -1,7 +1,7 @@
|
||||
edition = "2018"
|
||||
condense_wildcard_suffixes = true
|
||||
format_macro_matchers = true
|
||||
merge_imports = true
|
||||
imports_granularity = "Crate"
|
||||
use_field_init_shorthand = true
|
||||
format_code_in_doc_comments = true
|
||||
normalize_comments = true
|
||||
|
@ -303,14 +303,11 @@ impl IntoIterator for Args {
|
||||
type IntoIter = ::std::vec::IntoIter<String>;
|
||||
|
||||
fn into_iter(self) -> <Self as IntoIterator>::IntoIter {
|
||||
let mut args = Vec::new();
|
||||
|
||||
args.push("/bin/bash".into());
|
||||
args.push("-c".into());
|
||||
|
||||
let cmd = format!("{} ", self.image_args.args());
|
||||
args.push(cmd);
|
||||
|
||||
args.into_iter()
|
||||
vec![
|
||||
"/bin/bash".to_string(),
|
||||
"-c".to_string(),
|
||||
format!("{} ", self.image_args.args()),
|
||||
]
|
||||
.into_iter()
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
nightly-2020-08-13
|
||||
nightly-2021-01-31
|
||||
|
@ -1,7 +1,7 @@
|
||||
edition = "2018"
|
||||
condense_wildcard_suffixes = true
|
||||
format_macro_matchers = true
|
||||
merge_imports = true
|
||||
imports_granularity = "Crate"
|
||||
use_field_init_shorthand = true
|
||||
format_code_in_doc_comments = true
|
||||
normalize_comments = true
|
||||
|
@ -157,8 +157,7 @@ impl TransactionBlockHeight for Wallet {
|
||||
.await
|
||||
.map_err(|_| backoff::Error::Transient(Error::Io))?;
|
||||
|
||||
let block_height =
|
||||
block_height.ok_or_else(|| backoff::Error::Transient(Error::NotYetMined))?;
|
||||
let block_height = block_height.ok_or(backoff::Error::Transient(Error::NotYetMined))?;
|
||||
|
||||
Result::<_, backoff::Error<Error>>::Ok(block_height)
|
||||
})
|
||||
|
@ -17,7 +17,7 @@ impl Seed {
|
||||
Ok(Seed(seed::Seed::random()?))
|
||||
}
|
||||
|
||||
pub fn from_file_or_generate(data_dir: &PathBuf) -> Result<Self, Error> {
|
||||
pub fn from_file_or_generate(data_dir: &Path) -> Result<Self, Error> {
|
||||
let file_path_buf = data_dir.join("seed.pem");
|
||||
let file_path = Path::new(&file_path_buf);
|
||||
|
||||
|
@ -247,9 +247,7 @@ async fn run_until_internal(
|
||||
.await;
|
||||
|
||||
match publishded_redeem_tx {
|
||||
Ok(_) => {
|
||||
AliceState::BtcRedeemed
|
||||
}
|
||||
Ok(_) => AliceState::BtcRedeemed,
|
||||
Err(e) => {
|
||||
bail!("Waiting for Bitcoin transaction finality failed with {}! The redeem transaction was published, but it is not ensured that the transaction was included! You're screwed.", e)
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ async fn given_alice_restarts_after_encsig_is_learned_resume_swap() {
|
||||
let alice_state = alice::run_until(alice_swap, is_encsig_learned)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(matches!(alice_state, AliceState::EncSigLearned {..}));
|
||||
assert!(matches!(alice_state, AliceState::EncSigLearned { .. }));
|
||||
|
||||
let alice_swap = ctx.stop_and_resume_alice_from_db(alice_join_handle).await;
|
||||
assert!(matches!(alice_swap.state, AliceState::EncSigLearned {..}));
|
||||
assert!(matches!(alice_swap.state, AliceState::EncSigLearned { .. }));
|
||||
|
||||
let alice_state = alice::run(alice_swap).await.unwrap();
|
||||
|
||||
|
@ -14,10 +14,10 @@ async fn given_bob_restarts_after_encsig_is_sent_resume_swap() {
|
||||
|
||||
let bob_state = bob::run_until(bob_swap, is_encsig_sent).await.unwrap();
|
||||
|
||||
assert!(matches!(bob_state, BobState::EncSigSent {..}));
|
||||
assert!(matches!(bob_state, BobState::EncSigSent { .. }));
|
||||
|
||||
let bob_swap = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
|
||||
assert!(matches!(bob_swap.state, BobState::EncSigSent {..}));
|
||||
assert!(matches!(bob_swap.state, BobState::EncSigSent { .. }));
|
||||
|
||||
let bob_state = bob::run(bob_swap).await.unwrap();
|
||||
|
||||
|
@ -16,11 +16,13 @@ async fn given_bob_restarts_after_lock_proof_received_resume_swap() {
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(matches!(bob_state, BobState::XmrLockProofReceived {..}));
|
||||
assert!(matches!(bob_state, BobState::XmrLockProofReceived { .. }));
|
||||
|
||||
let bob_swap = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
|
||||
assert!(matches!(bob_swap.state, BobState::XmrLockProofReceived
|
||||
{..}));
|
||||
assert!(matches!(
|
||||
bob_swap.state,
|
||||
BobState::XmrLockProofReceived { .. }
|
||||
));
|
||||
|
||||
let bob_state = bob::run(bob_swap).await.unwrap();
|
||||
|
||||
|
@ -14,10 +14,10 @@ async fn given_bob_restarts_after_xmr_is_locked_resume_swap() {
|
||||
|
||||
let bob_state = bob::run_until(bob_swap, is_xmr_locked).await.unwrap();
|
||||
|
||||
assert!(matches!(bob_state, BobState::XmrLocked {..}));
|
||||
assert!(matches!(bob_state, BobState::XmrLocked { .. }));
|
||||
|
||||
let bob_swap = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
|
||||
assert!(matches!(bob_swap.state, BobState::XmrLocked {..}));
|
||||
assert!(matches!(bob_swap.state, BobState::XmrLocked { .. }));
|
||||
|
||||
let bob_state = bob::run(bob_swap).await.unwrap();
|
||||
|
||||
|
@ -16,7 +16,7 @@ async fn alice_punishes_if_bob_never_acts_after_fund() {
|
||||
|
||||
let bob_state = bob::run_until(bob_swap, is_btc_locked).await.unwrap();
|
||||
|
||||
assert!(matches!(bob_state, BobState::BtcLocked {..}));
|
||||
assert!(matches!(bob_state, BobState::BtcLocked { .. }));
|
||||
|
||||
let alice_state = alice_handle.await.unwrap();
|
||||
ctx.assert_alice_punished(alice_state.unwrap()).await;
|
||||
@ -24,7 +24,7 @@ async fn alice_punishes_if_bob_never_acts_after_fund() {
|
||||
// Restart Bob after Alice punished to ensure Bob transitions to
|
||||
// punished and does not run indefinitely
|
||||
let bob_swap = ctx.stop_and_resume_bob_from_db(bob_join_handle).await;
|
||||
assert!(matches!(bob_swap.state, BobState::BtcLocked {..}));
|
||||
assert!(matches!(bob_swap.state, BobState::BtcLocked { .. }));
|
||||
|
||||
let bob_state = bob::run(bob_swap).await.unwrap();
|
||||
|
||||
|
@ -15,8 +15,7 @@ async fn given_alice_restarts_after_xmr_is_locked_refund_swap() {
|
||||
let bob_handle = tokio::spawn(bob);
|
||||
|
||||
let alice_state = alice::run_until(alice_swap, is_xmr_locked).await.unwrap();
|
||||
assert!(matches!(alice_state,
|
||||
AliceState::XmrLocked {..}));
|
||||
assert!(matches!(alice_state, AliceState::XmrLocked { .. }));
|
||||
|
||||
// Alice does not act, Bob refunds
|
||||
let bob_state = bob_handle.await.unwrap();
|
||||
@ -24,7 +23,7 @@ async fn given_alice_restarts_after_xmr_is_locked_refund_swap() {
|
||||
|
||||
// Once bob has finished Alice is restarted and refunds as well
|
||||
let alice_swap = ctx.stop_and_resume_alice_from_db(alice_join_handle).await;
|
||||
assert!(matches!(alice_swap.state, AliceState::XmrLocked {..}));
|
||||
assert!(matches!(alice_swap.state, AliceState::XmrLocked { .. }));
|
||||
|
||||
let alice_state = alice::run(alice_swap).await.unwrap();
|
||||
|
||||
|
@ -22,7 +22,7 @@ async fn given_alice_restarts_after_enc_sig_learned_and_bob_already_cancelled_re
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(
|
||||
matches!(alice_state, AliceState::EncSigLearned {..}),
|
||||
matches!(alice_state, AliceState::EncSigLearned { .. }),
|
||||
"Alice state is not EncSigLearned: {:?}",
|
||||
alice_state
|
||||
);
|
||||
@ -34,8 +34,7 @@ async fn given_alice_restarts_after_enc_sig_learned_and_bob_already_cancelled_re
|
||||
// Once bob has finished Alice is restarted and refunds as well
|
||||
let alice_swap = ctx.stop_and_resume_alice_from_db(alice_join_handle).await;
|
||||
assert!(
|
||||
matches!(alice_swap.state, AliceState::EncSigLearned
|
||||
{..}),
|
||||
matches!(alice_swap.state, AliceState::EncSigLearned { .. }),
|
||||
"Alice state is not EncSigLearned: {:?}",
|
||||
alice_state
|
||||
);
|
||||
|
@ -478,17 +478,11 @@ pub mod alice_run_until {
|
||||
use swap::protocol::alice::AliceState;
|
||||
|
||||
pub fn is_xmr_locked(state: &AliceState) -> bool {
|
||||
matches!(
|
||||
state,
|
||||
AliceState::XmrLocked{..}
|
||||
)
|
||||
matches!(state, AliceState::XmrLocked { .. })
|
||||
}
|
||||
|
||||
pub fn is_encsig_learned(state: &AliceState) -> bool {
|
||||
matches!(
|
||||
state,
|
||||
AliceState::EncSigLearned{..}
|
||||
)
|
||||
matches!(state, AliceState::EncSigLearned { .. })
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user