From 6512493fbe782b573df586a45741eb00a7f3cc15 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Tue, 4 Jun 2024 11:40:52 +0200 Subject: [PATCH] fmt --- swap/src/protocol/bob/state.rs | 5 +---- ...appy_path_bob_offline_while_alice_redeems_btc.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/swap/src/protocol/bob/state.rs b/swap/src/protocol/bob/state.rs index 4e042a20..58c1d723 100644 --- a/swap/src/protocol/bob/state.rs +++ b/swap/src/protocol/bob/state.rs @@ -489,10 +489,7 @@ pub struct State4 { } impl State4 { - pub async fn check_for_tx_redeem( - &self, - bitcoin_wallet: &bitcoin::Wallet, - ) -> Result { + pub async fn check_for_tx_redeem(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result { let tx_redeem = bitcoin::TxRedeem::new(&self.tx_lock, &self.redeem_address, self.tx_redeem_fee); let tx_redeem_encsig = self.b.encsign(self.S_a_bitcoin, tx_redeem.digest()); diff --git a/swap/tests/happy_path_bob_offline_while_alice_redeems_btc.rs b/swap/tests/happy_path_bob_offline_while_alice_redeems_btc.rs index 32882d75..c958c4f0 100644 --- a/swap/tests/happy_path_bob_offline_while_alice_redeems_btc.rs +++ b/swap/tests/happy_path_bob_offline_while_alice_redeems_btc.rs @@ -1,10 +1,10 @@ pub mod harness; -use tokio::join; +use crate::harness::bob_run_until::is_encsig_sent; use swap::asb::FixedRate; -use swap::protocol::{alice, bob}; use swap::protocol::bob::BobState; -use crate::harness::bob_run_until::{is_encsig_sent}; +use swap::protocol::{alice, bob}; +use tokio::join; #[tokio::test] async fn given_bob_restarts_while_alice_redeems_btc() { @@ -21,9 +21,8 @@ async fn given_bob_restarts_while_alice_redeems_btc() { ctx.assert_alice_redeemed(alice_state??).await; assert!(matches!(bob_state??, BobState::EncSigSent { .. })); - let (bob_swap, _) = ctx.stop_and_resume_bob_from_db(bob_handle, swap_id).await; - + if let BobState::EncSigSent(state4) = bob_swap.state.clone() { bob_swap .bitcoin_wallet @@ -34,7 +33,7 @@ async fn given_bob_restarts_while_alice_redeems_btc() { } else { panic!("Bob in unexpected state {}", bob_swap.state); } - + // Restart Bob let bob_state = bob::run(bob_swap).await?; ctx.assert_bob_redeemed(bob_state).await; @@ -42,4 +41,4 @@ async fn given_bob_restarts_while_alice_redeems_btc() { Ok(()) }) .await; -} \ No newline at end of file +}