SatoshiPortal / boltz-rust

Boltz client rust crate
https://docs.boltz.exchange
30 stars 16 forks source link

`swap status` fails on mainnet #39

Closed ok300 closed 1 month ago

ok300 commented 2 months ago

Using the latest commit, calls to BoltzApiClient::swap_status fail on mainnet.

Sample code:

use boltz_client::swaps::boltz::*;

fn main() {
    let client = BoltzApiClient::new(BOLTZ_MAINNET_URL);
    let id = "rkLrdN".to_string(); // Swap ID
    let res = client.swap_status(SwapStatusRequest { id });
    println!("Res: {res:?}");
}

results in

Res: Err(IO(Custom { kind: UnexpectedEof, error: "peer closed connection without sending TLS close_notify: https://docs.rs/rustls/latest/rustls/manual/_03_howto/index.html#unexpected-eof" }))

Cargo.toml:

[package]
name = "test-boltz-rust"
version = "0.1.0"
edition = "2021"

[dependencies]
boltz-client = { git = "https://github.com/SatoshiPortal/boltz-rust", rev = "cf2544ae126ac46ab2118313d61a57f160e3d64e" }

[patch.crates-io]
secp256k1-zkp = {git = "https://github.com/BlockstreamResearch/rust-secp256k1-zkp.git", rev = "60e631c24588a0c9e271badd61959294848c665d"}

The same snippet works well on testnet (with a testnet swap ID) :

use boltz_client::swaps::boltz::*;

fn main() {
    let client = BoltzApiClient::new(BOLTZ_TESTNET_URL);
    let id = "K3X3uk".to_string(); // Swap ID
    let res = client.swap_status(SwapStatusRequest { id });
    println!("Res: {res:?}");
}

returns

Res: Ok(SwapStatusResponse { status: "swap.created", zero_conf_rejected: None })

ok300 commented 2 months ago

I initially thought it's due to missing headers from Boltz ( https://github.com/BoltzExchange/boltz-backend/issues/537 ) but it's not the case.

ok300 commented 1 month ago

Was fixed in #41