mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-14 17:26:11 -04:00
Improve error messages when determining BTC amount to be swapped
This commit is contained in:
parent
4138039ea0
commit
1aa6d177bf
2 changed files with 7 additions and 3 deletions
|
@ -313,14 +313,18 @@ async fn determine_btc_to_swap(
|
||||||
bid_quote.max_quantity
|
bid_quote.max_quantity
|
||||||
);
|
);
|
||||||
|
|
||||||
let new_balance = wait_for_deposit.await?;
|
let new_balance = wait_for_deposit
|
||||||
|
.await
|
||||||
|
.context("Failed to wait for Bitcoin deposit")?;
|
||||||
|
|
||||||
info!("Received {}", new_balance);
|
info!("Received {}", new_balance);
|
||||||
} else {
|
} else {
|
||||||
info!("Found {} in wallet", initial_balance);
|
info!("Found {} in wallet", initial_balance);
|
||||||
}
|
}
|
||||||
|
|
||||||
let max_giveable = max_giveable.await?;
|
let max_giveable = max_giveable
|
||||||
|
.await
|
||||||
|
.context("Failed to compute max 'giveable' Bitcoin amount")?;
|
||||||
let max_accepted = bid_quote.max_quantity;
|
let max_accepted = bid_quote.max_quantity;
|
||||||
|
|
||||||
if max_giveable > max_accepted {
|
if max_giveable > max_accepted {
|
||||||
|
|
|
@ -155,7 +155,7 @@ impl Wallet {
|
||||||
tx_builder.set_single_recipient(dummy_script);
|
tx_builder.set_single_recipient(dummy_script);
|
||||||
tx_builder.drain_wallet();
|
tx_builder.drain_wallet();
|
||||||
tx_builder.fee_rate(self.select_feerate());
|
tx_builder.fee_rate(self.select_feerate());
|
||||||
let (_, details) = tx_builder.finish()?;
|
let (_, details) = tx_builder.finish().context("Failed to build transaction")?;
|
||||||
|
|
||||||
let max_giveable = details.sent - details.fees;
|
let max_giveable = details.sent - details.fees;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue