mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-30 20:46:33 -05:00
Spawn event loop before requesting quote
This commit is contained in:
parent
a53a420794
commit
2c6c7b964c
1 changed files with 3 additions and 1 deletions
|
|
@ -356,6 +356,8 @@ impl Request {
|
|||
|
||||
let (event_loop, mut event_loop_handle) =
|
||||
EventLoop::new(swap_id, swarm, seller_peer_id)?;
|
||||
let event_loop = tokio::spawn(event_loop.run().in_current_span());
|
||||
|
||||
let max_givable = || bitcoin_wallet.max_giveable(TxLock::script_size());
|
||||
let estimate_fee = |amount| bitcoin_wallet.estimate_fee(TxLock::weight(), amount);
|
||||
let determine_amount = determine_btc_to_swap(
|
||||
|
|
@ -368,6 +370,7 @@ impl Request {
|
|||
estimate_fee,
|
||||
);
|
||||
|
||||
|
||||
let (amount, fees) = match determine_amount.await {
|
||||
Ok(val) => val,
|
||||
Err(error) => match error.downcast::<ZeroQuoteReceived>() {
|
||||
|
|
@ -403,7 +406,6 @@ impl Request {
|
|||
amount,
|
||||
);
|
||||
|
||||
let event_loop = tokio::spawn(event_loop.run().in_current_span());
|
||||
Ok((event_loop,swap))
|
||||
} => result,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue