feat: Retry by abusing state machine

This commit is contained in:
binarybaron 2024-07-25 14:57:30 +02:00
parent c80bdb2d8c
commit c68e282a4f
No known key found for this signature in database
GPG Key ID: 99B75D3E1476A26E

View File

@ -119,12 +119,22 @@ where
let transfer_proof = monero_wallet let transfer_proof = monero_wallet
.transfer(state3.lock_xmr_transfer_request()) .transfer(state3.lock_xmr_transfer_request())
.await?; .await;
AliceState::XmrLockTransactionSent { match transfer_proof {
monero_wallet_restore_blockheight, Ok(transfer_proof) => {
transfer_proof, AliceState::XmrLockTransactionSent {
state3, monero_wallet_restore_blockheight,
transfer_proof,
state3,
}
}
Err(e) => {
tracing::error!("Failed to lock XMR: {:#}", e);
// Sleep 10seconds
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
AliceState::BtcLocked { state3 }
}
} }
} }
_ => AliceState::SafelyAborted, _ => AliceState::SafelyAborted,