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

👋 I see @tnull was un-assigned.
If you'd like another reviewer assignment, please click here.

@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.

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 72.38095% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.06%. Comparing base (fcc3d33) to head (83f1e7b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
lightning-block-sync/src/convert.rs 0.00% 21 Missing ⚠️
lightning-block-sync/src/rpc.rs 60.86% 13 Missing and 5 partials ⚠️
lightning-block-sync/src/http.rs 87.59% 14 Missing and 3 partials ⚠️
lightning-block-sync/src/rest.rs 66.66% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4350      +/-   ##
==========================================
- Coverage   86.09%   86.06%   -0.03%     
==========================================
  Files         156      156              
  Lines      102804   102708      -96     
  Branches   102804   102708      -96     
==========================================
- Hits        88508    88397     -111     
- Misses      11787    11819      +32     
+ Partials     2509     2492      -17     
Flag Coverage Δ
tests 86.06% <72.38%> (-0.03%) ⬇️

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.

@@ -572,27 +334,54 @@ mod endpoint_tests {
#[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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This wasn't addressed. Do you agree? Are there some tests you think are useful here?

Copy link
Author

Choose a reason for hiding this comment

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

I'm unsure on what else can be tested in this, there isn't any heavy stuff that we can test here, so if you can suggest any then i'll add those.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If there's tests that aren't testing anything useful, we should remove them.

@Apostlex0 Apostlex0 requested a review from tnull January 27, 2026 13:40
@joostjager joostjager removed their request for review January 28, 2026 09:23
@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@TheBlueMatt TheBlueMatt removed the request for review from tnull January 29, 2026 15:44
Comment on lines 134 to 135
.with_header("Host", host)
.with_header("Connection", "keep-alive")
Copy link
Collaborator

Choose a reason for hiding this comment

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

please let bitreq handle this

Comment on lines 137 to 138
.with_max_headers_size(Some(MAX_HTTP_MESSAGE_HEADER_SIZE))
.with_max_status_line_length(Some(MAX_HTTP_MESSAGE_HEADER_SIZE))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please let bitreq handle this

Some(address) => address,
};

// Verify reachability by attempting a connection.
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you're gonna verify, please make a request

}

/// Converts a bitreq error to an std::io::Error.
fn bitreq_to_io_error(err: bitreq::Error) -> std::io::Error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please just change the API?

Copy link
Author

@Apostlex0 Apostlex0 Jan 29, 2026

Choose a reason for hiding this comment

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

doing that would mean that we will have to make changes in the ldk-node as well, so should i do that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that would be much appreciated.

@@ -572,27 +334,54 @@ mod endpoint_tests {
#[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.

This wasn't addressed. Do you agree? Are there some tests you think are useful here?

@Apostlex0 Apostlex0 force-pushed the feat/blocks-sync-bitreq branch from 8abe808 to 16677e7 Compare January 30, 2026 09:44
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