-
Notifications
You must be signed in to change notification settings - Fork 421
Add support for Testnet4
#4148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add support for Testnet4
#4148
Conversation
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`.
👋 Thanks for assigning @jkczyz as a reviewer! |
match currency { | ||
Currency::Bitcoin => Network::Bitcoin, | ||
Currency::BitcoinTestnet => Network::Testnet, | ||
Currency::BitcoinTestnet4 => Network::Testnet4, |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
?
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
let currency_code = match *self { | ||
Currency::Bitcoin => "bc", | ||
Currency::BitcoinTestnet => "tb", | ||
Currency::BitcoinTestnet4 => "tb", |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lightning postdates tn3
We simply add support for
bitcoin::Network::Testnet4
, which was added with release v0.32.4, which we hence deem the new minimal requirement forlightning
andlightning-invoice
.