Fix receive-payment by increasing claim absolute_fee

This commit is contained in:
ok300
2024-03-18 18:23:50 +01:00
parent 682b45bc8f
commit a2202ecbcd
2 changed files with 13 additions and 8 deletions

View File

@@ -64,8 +64,8 @@ pub struct SendPaymentResponse {
#[derive(thiserror::Error, Debug)]
pub enum SwapError {
#[error("Could not contact Boltz servers")]
ServersUnreachable,
#[error("Could not contact Boltz servers: {err}")]
ServersUnreachable { err: String },
#[error("Invoice amount is out of range")]
AmountOutOfRange,
@@ -90,7 +90,9 @@ impl From<S5Error> for SwapError {
fn from(err: S5Error) -> Self {
match err.kind {
boltz_client::util::error::ErrorKind::Network
| boltz_client::util::error::ErrorKind::BoltzApi => SwapError::ServersUnreachable,
| boltz_client::util::error::ErrorKind::BoltzApi => SwapError::ServersUnreachable {
err: err.message
},
boltz_client::util::error::ErrorKind::Input => SwapError::BadResponse,
_ => SwapError::BoltzGeneric { err: err.message },
}

View File

@@ -20,7 +20,7 @@ use boltz_client::{
Keypair, ZKKeyPair,
};
use lightning_invoice::Bolt11Invoice;
use log::{debug, info};
use log::{debug, info, warn};
use lwk_common::Signer;
use lwk_signer::{AnySigner, SwSigner};
use lwk_wollet::{
@@ -33,7 +33,8 @@ use crate::{
WalletOptions,
};
const CLAIM_ABSOLUTE_FEES: u64 = 0;
// To avoid sendrawtransaction error "min relay fee not met"
const CLAIM_ABSOLUTE_FEES: u64 = 134;
const BLOCKSTREAM_ELECTRUM_URL: &str = "blockstream.info:465";
pub struct Wallet {
@@ -84,11 +85,11 @@ impl Wallet {
thread::scope(|scope| {
for claim in pending_claims.iter() {
info!("Trying to claim at address {}", claim.lockup_address);
info!("Trying to claim from lockup address {}", claim.lockup_address);
scope.spawn(|| match cloned.try_claim(claim) {
Ok(txid) => info!("Claim successful! Txid: {txid}"),
Err(e) => info!("Could not claim yet. Err: {}", e),
Err(e) => warn!("Could not claim yet. Err: {}", e),
});
}
});
@@ -304,7 +305,9 @@ impl Wallet {
);
self.wait_swap_status(&swap_id, SwapStatus::Created)
.map_err(|_| SwapError::ServersUnreachable)?;
.map_err(|e| SwapError::BoltzGeneric {
err: e.to_string()
})?;
let claim_details = ClaimDetails {
redeem_script,