Skip to content

Conversation

@Apostlex0
Copy link

@Apostlex0 Apostlex0 commented Jan 27, 2026

fixes #4325
the ldk-node tests doesn't seem to need any changes as the changes here preserve the public api, hence what happens internally doesn't really matter as all the existing tests pass without any problems.
Though changes to payment/bolt11.rs were needed to compile and run the tests.

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 27, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@Apostlex0
Copy link
Author

@TheBlueMatt the ci fails due to the problem in payment/bolt11.rs in ldk-node, which is unrelated to this task, should i open a pr to fix this in ldk-node as i have made the changes locally while testing.

@tnull tnull self-requested a review January 27, 2026 09:24
Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look, had a quick first look, here are some initial remarks.

/// Client for making HTTP requests.
pub(crate) struct HttpClient {
address: SocketAddr,
stream: TcpStream,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you'll want to hold a bitreq::Client here to reuse the same connection pool for subsequent requests.

I do however wonder if we still need the HttpClient wrapper at all?

rpc-client = [ "serde_json", "chunked_transfer" ]
rest-client = [ "serde_json", "bitreq" ]
rpc-client = [ "serde_json", "bitreq" ]
tokio = [ "dep:tokio", "bitreq/async" ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused: why does tokio depend on bitreq?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing this to bitreq?/async this is because the rest and rpc client enables the sync mode of bitreq by default so this would enable the async mode of bitreq which uses send_async_with_client() if bitreq exists.

/// Server for handling HTTP client requests with a stock response.
pub struct HttpServer {
address: std::net::SocketAddr,
#[allow(dead_code)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to allow dead code here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was causing a warning so i kept that before, though now I've Implemented Drop for HttpServer that will use all the fields.

@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 88.59649% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.08%. Comparing base (9e91b2e) to head (8abe808).

Files with missing lines Patch % Lines
lightning-block-sync/src/http.rs 88.59% 11 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4350      +/-   ##
==========================================
- Coverage   86.08%   86.08%   -0.01%     
==========================================
  Files         156      156              
  Lines      102428   102326     -102     
  Branches   102428   102326     -102     
==========================================
- Hits        88179    88084      -95     
- Misses      11754    11769      +15     
+ Partials     2495     2473      -22     
Flag Coverage Δ
tests 86.08% <88.59%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

}

#[cfg(test)]
pub(crate) mod client_tests {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not convinced that any of the remaining tests in this file test anything useful now.

@Apostlex0 Apostlex0 requested a review from tnull January 27, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch lightning-block-sync to bitreq

4 participants