This commit is contained in:
Byron Hambly 2024-06-04 11:40:52 +02:00
parent 66ab36fc51
commit 6512493fbe
No known key found for this signature in database
GPG Key ID: DE8F6EA20A661697
2 changed files with 7 additions and 11 deletions

View File

@ -489,10 +489,7 @@ pub struct State4 {
}
impl State4 {
pub async fn check_for_tx_redeem(
&self,
bitcoin_wallet: &bitcoin::Wallet,
) -> Result<State5> {
pub async fn check_for_tx_redeem(&self, bitcoin_wallet: &bitcoin::Wallet) -> Result<State5> {
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());

View File

@ -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;
}
}