Skip to content

Conversation

tnull
Copy link
Contributor

@tnull tnull commented Oct 8, 2025

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.

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`.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Oct 8, 2025

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

match currency {
Currency::Bitcoin => Network::Bitcoin,
Currency::BitcoinTestnet => Network::Testnet,
Currency::BitcoinTestnet4 => Network::Testnet4,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could also consider not adding a new Currency variant, but if we just kept Currency::BitcoinTestnet we wouldn't be able to make this mapping back to Testnet4.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We already kinda cant, though? If someone reads an invoice with the tb prefix they'll get a Currency/Network of testnet, which won't map to tn4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already kinda cant, though? If someone reads an invoice with the tb prefix they'll get a Currency/Network of testnet, which won't map to tn4.

Okay, so what resolution do you suggest then? Opening a spec PR for a new BOLT11 prefix for Testnet4? As I mentioned below I was close to do this, but refrained so far as I thought the idea was that Testnet3 eventually is just superseded by Testnet4 and goes away. But maybe it's the easiest solution here, though we'll need to double-check that other impls are onboard with it ofc.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yea, I dunno, its definitely awk either way. We should at least explore it at the spec level, I imagine, but we can also map Testnet4 to Currency::BitcoinTestnet for now so that you can build an invoice from Network::Testnet4?

@tnull tnull requested a review from jkczyz October 8, 2025 08:48
Copy link

codecov bot commented Oct 8, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.63%. Comparing base (2efb009) to head (a0b4c2e).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
lightning-invoice/src/lib.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4148      +/-   ##
==========================================
- Coverage   88.63%   88.63%   -0.01%     
==========================================
  Files         180      180              
  Lines      135241   135245       +4     
  Branches   135241   135245       +4     
==========================================
  Hits       119869   119869              
+ Misses      12607    12605       -2     
- Partials     2765     2771       +6     
Flag Coverage Δ
fuzzing 21.75% <0.00%> (-0.01%) ⬇️
tests 88.47% <50.00%> (-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.

let currency_code = match *self {
Currency::Bitcoin => "bc",
Currency::BitcoinTestnet => "tb",
Currency::BitcoinTestnet4 => "tb",
Copy link
Contributor

Choose a reason for hiding this comment

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

is this what other implementations are doing? would be a shame to lose the one-to-one mapping

Copy link
Contributor Author

@tnull tnull Oct 9, 2025

Choose a reason for hiding this comment

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

AFAICT yes. BOLT11 speaks about 'testnet' overall, without a specific version. I considered a PR to introduce a change specific to Testnet4 (e.g. tb4), but given that Testnet3 is supposed to eventually go away it could make sense to reuse the same prefix?

Not sure how this was handled during previous testnet upgrades though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

lightning postdates tn3

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.

4 participants