What changed, and why it matters
This commit only adds new test cases for invoice parsing. It does not change any production code, so it cannot introduce a security vulnerability or fix one. The tests verify that the software correctly handles recently published standard test vectors for Bitcoin Lightning invoices, including a valid mainnet invoice with a modern address format and an invalid offer with a malformed currency code.
No security action required. This is a test-only change. Reviewers may optionally verify the new test vectors match the referenced BOLT PRs and that existing tests pass.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds test vectors from BOLT specification pull requests #1276 and #1264. It extends offers-test.json with one additional malformed BOLT12 offer case (invalid 3-letter currency UTF-8) and adds one new Bolt11InvoiceSpec test case for a mainnet BOLT11 invoice containing a P2TR fallback address. No implementation code is modified.
Changed components
eclair-core/src/test/resources/offers-test.jsoneclair-core/src/test/scala/fr/acinq/eclair/payment/Bolt11InvoiceSpec.scalaInspect captured patch +16 / −1
diff --git a/eclair-core/src/test/resources/offers-test.json b/eclair-core/src/test/resources/offers-test.json
index 891ed56..1096a1a 100644
--- a/eclair-core/src/test/resources/offers-test.json
+++ b/eclair-core/src/test/resources/offers-test.json
@@ -489,10 +489,15 @@
"bolt12": "lno1qcqcqzs9g9xyjs69zcssyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqsz"
},
{
- "description": "Malformed: invalid currency UTF-8",
+ "description": "Malformed: invalid currency UTF-8 (2-letter code)",
"valid": false,
"bolt12": "lno1qcpgqsg2q4q5cj2rg5tzzqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqg"
},
+ {
+ "description": "Malformed: invalid currency UTF-8 (3-letter code)",
+ "valid": false,
+ "bolt12": "lno1qcplllhapqpq86q2q4qkc6trv5tzzq6muh550qsfva9fdes0ruph7ctk2s8aqq06r4jxj3msc448wzwy9s"
+ },
{
"description": "Malformed: truncated description UTF-8",
"valid": false,
diff --git a/eclair-core/src/test/scala/fr/acinq/eclair/payment/Bolt11InvoiceSpec.scala b/eclair-core/src/test/scala/fr/acinq/eclair/payment/Bolt11InvoiceSpec.scala
index 6e91337..dad1d24 100644
--- a/eclair-core/src/test/scala/fr/acinq/eclair/payment/Bolt11InvoiceSpec.scala
+++ b/eclair-core/src/test/scala/fr/acinq/eclair/payment/Bolt11InvoiceSpec.scala
@@ -386,6 +386,16 @@ class Bolt11InvoiceSpec extends AnyFunSuite {
assert(invoice.sign(priv).toString == ref)
}
+ test("On mainnet, with fallback (P2TR) address bc1pptdvg0d2nj99568qn6ssdy4cygnwuxgw2ukmnwgwz7jpqjz2kszse2s3lm") {
+ val ref = "lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqsfp4pptdvg0d2nj99568qn6ssdy4cygnwuxgw2ukmnwgwz7jpqjz2kszs9qrsgqy606dznq28exnydt2r4c29y56xjtn3sk4mhgjtl4pg2y4ar3249rq4ajlmj9jy8zvlzw7cr8mggqzm842xfr0v72rswzq9xvr4hknfsqwmn6xd"
+ val Success(invoice) = Bolt11Invoice.fromString(ref)
+ assert(invoice.prefix == "lnbc")
+ assert(invoice.amount_opt.contains(2000000000 msat))
+ assert(invoice.nodeId == PublicKey(hex"03e7156ae33b0a208d0744199163177e909e80176e55d97a2f221ede0f934dd9ad"))
+ assert(invoice.fallbackAddress().contains("bc1pptdvg0d2nj99568qn6ssdy4cygnwuxgw2ukmnwgwz7jpqjz2kszse2s3lm"))
+ assert(invoice.sign(priv).toString == ref)
+ }
+
test("reject invalid invoices") {
val refs = Seq(
// Bech32 checksum is invalid.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.