Skip to content

Commit 509e939

Browse files
committed
Route pay_any LNURL fetches through the shared HTTP client
`HTTPHrnResolver::new()` builds its own `reqwest::Client` and ignores any proxy config, so LN-Address pays via /pay were reaching the LNURL callback host directly even when `socks_proxy` was set. /getbalance's max_sendable path was fixed in the previous commit; this is the matching fix for the actual send path. Expose `MdkClient::http_client()` and pass that shared client to `HTTPHrnResolver::with_client`. No new dependency; the client was already built in `MdkClient::new()` and handed to `MdkApiClient`. Possible only because the reqwest 0.13 bump aligned mdkd with bitcoin-payment-instructions; pre-bump the two crates pinned incompatible reqwest majors and `with_client` rejected ours.
1 parent 051aec2 commit 509e939

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/daemon/api/pay_any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub async fn handle_pay(state: AppState, req: &PayRequest) -> Result<PayResponse
6262
};
6363

6464
let network = state.node.config().network;
65-
let resolver = HTTPHrnResolver::new();
65+
let resolver = HTTPHrnResolver::with_client(state.mdk_client.http_client().clone());
6666
let instructions = PaymentInstructions::parse(req.destination.trim(), network, &resolver, true)
6767
.await
6868
.map_err(map_parse_error)?;

src/mdk/client.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ impl MdkClient {
147147
self.lsp_pubkey
148148
}
149149

150+
/// Shared `reqwest::Client` honouring `socks_proxy`. Hand to
151+
/// any HTTP-using crate (e.g. `HTTPHrnResolver::with_client`)
152+
/// rather than building a fresh `reqwest::Client` that would
153+
/// bypass the proxy.
154+
pub fn http_client(&self) -> &Client {
155+
&self.http_client
156+
}
157+
150158
/// Best-effort estimate of the largest amount that can flow out
151159
/// over Lightning right now, with routing-fee headroom subtracted.
152160
/// Recomputed from `node.list_channels()` on every call so the

0 commit comments

Comments
 (0)