mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-27 03:06:24 -05:00
Merge #405
405: Concurrent swaps with same peer r=da-kami a=da-kami Fixes #367 - [x] Concurrent swaps with same peer Not sure how much more time I should invest into this. We could just merge the current state and then do improvements on top...? Improvements: - [x] Think `// TODO: Remove unnecessary swap-id check` through and remove it - [x] Add concurrent swap test, multiple swaps with same Bob - [ ] Save swap messages without matching swap in execution in the database - [ ] Assert the balances in the new concurrent swap tests - [ ] ~~Add concurrent swap test, multiple swaps with different Bobs~~ - [ ] ~~Send swap-id in separate message, not on top of `Message0`~~ Co-authored-by: Daniel Karzel <daniel@comit.network>
This commit is contained in:
commit
19766b9759
31 changed files with 456 additions and 127 deletions
|
|
@ -68,6 +68,7 @@ async fn next_state(
|
|||
let bitcoin_refund_address = bitcoin_wallet.new_address().await?;
|
||||
|
||||
let state2 = request_price_and_setup(
|
||||
swap_id,
|
||||
btc_amount,
|
||||
event_loop_handle,
|
||||
env_config,
|
||||
|
|
@ -106,7 +107,7 @@ async fn next_state(
|
|||
|
||||
select! {
|
||||
transfer_proof = transfer_proof_watcher => {
|
||||
let transfer_proof = transfer_proof?.tx_lock_proof;
|
||||
let transfer_proof = transfer_proof?;
|
||||
|
||||
tracing::info!(txid = %transfer_proof.tx_hash(), "Alice locked Monero");
|
||||
|
||||
|
|
@ -259,6 +260,7 @@ async fn next_state(
|
|||
}
|
||||
|
||||
pub async fn request_price_and_setup(
|
||||
swap_id: Uuid,
|
||||
btc: bitcoin::Amount,
|
||||
event_loop_handle: &mut EventLoopHandle,
|
||||
env_config: &Config,
|
||||
|
|
@ -269,6 +271,7 @@ pub async fn request_price_and_setup(
|
|||
tracing::info!("Spot price for {} is {}", btc, xmr);
|
||||
|
||||
let state0 = State0::new(
|
||||
swap_id,
|
||||
&mut OsRng,
|
||||
btc,
|
||||
xmr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue