rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Add support for `Testnet4`

Open tnull opened this issue 2 months ago • 7 comments

We simply add support for bitcoin::Network::Testnet4, which was added with release v0.32.4, which we hence deem the new minimal requirement for lightning and lightning-invoice.

tnull avatar Oct 08 '25 08:10 tnull

👋 Thanks for assigning @benthecarman 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.

ldk-reviews-bot avatar Oct 08 '25 08:10 ldk-reviews-bot

Codecov Report

:x: Patch coverage is 0% with 1 line in your changes missing coverage. Please review. :white_check_mark: Project coverage is 89.33%. Comparing base (6d4897c) to head (743f43f). :warning: Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
lightning-invoice/src/lib.rs 0.00% 1 Missing :warning:
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #4148    +/-   ##
========================================
  Coverage   89.32%   89.33%            
========================================
  Files         180      180            
  Lines      138329   138480   +151     
  Branches   138329   138480   +151     
========================================
+ Hits       123566   123710   +144     
+ Misses      12157    12148     -9     
- Partials     2606     2622    +16     
Flag Coverage Δ
fuzzing 35.96% <0.00%> (+0.07%) :arrow_up:
tests 88.70% <0.00%> (+<0.01%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar Oct 08 '25 08:10 codecov[bot]

🔔 1st Reminder

Hey @jkczyz! 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.

ldk-reviews-bot avatar Oct 11 '25 00:10 ldk-reviews-bot

🔔 2nd Reminder

Hey @jkczyz! 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.

ldk-reviews-bot avatar Oct 13 '25 00:10 ldk-reviews-bot

🔔 3rd Reminder

Hey @jkczyz! 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.

ldk-reviews-bot avatar Oct 15 '25 00:10 ldk-reviews-bot

🔔 4th Reminder

Hey @jkczyz! 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.

ldk-reviews-bot avatar Oct 18 '25 00:10 ldk-reviews-bot

🔔 5th Reminder

Hey @jkczyz! 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.

ldk-reviews-bot avatar Oct 20 '25 00:10 ldk-reviews-bot

Since the other Lightning implementations seem to just map Testnet4 to Testnet, I now updated this PR to follow suit and not introduce a new Currency variant. Note this could lead to verification issues down the line, since we now might return a wrong Network from Bolt11Invoice::network and use a wrong network in fallback_addresses.

@TheBlueMatt @benthecarman Any opinions how to do better if the community doesn't seem to be enthused about introducing a separate prefix for testnet4?

tnull avatar Nov 18 '25 14:11 tnull

It seemed like people on the call were just viewing testnet4 LN as DoA, so not much reason to worry about supporting it well IMO.

TheBlueMatt avatar Nov 18 '25 14:11 TheBlueMatt

Hmm, yea, this is fine. Annoying, but fine. Maybe the docs for Currency::Testnet should be updated to reference that its both?

Amended with some more docs:

> git diff-tree -U2 c49c982bb 743f43fcf
diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs
index 2bc6e53d9..0dbb3bdb0 100644
--- a/lightning-invoice/src/lib.rs
+++ b/lightning-invoice/src/lib.rs
@@ -439,4 +439,6 @@ pub enum Currency {

        /// Bitcoin testnet
+       ///
+       /// Note this will also be used for invoices on [`Network::Testnet4`].
        BitcoinTestnet,

@@ -1623,4 +1625,7 @@ impl Bolt11Invoice {
        /// Returns the network for which the invoice was issued
        ///
+       /// **Caution**: On Testnet4, this method will return [`Network::Testnet`]` rather than
+       /// [`Network::Testnet4`].
+       ///
        /// This is not exported to bindings users, see [`Self::currency`] instead.
        pub fn network(&self) -> Network {

tnull avatar Nov 18 '25 14:11 tnull

CI failure looks like a flake.

TheBlueMatt avatar Nov 18 '25 17:11 TheBlueMatt