bolt12: Add test vector for missing offer_amount with offer_currency#1279
Merged
t-bast merged 1 commit intolightning:masterfrom Jan 5, 2026
Merged
bolt12: Add test vector for missing offer_amount with offer_currency#1279t-bast merged 1 commit intolightning:masterfrom
t-bast merged 1 commit intolightning:masterfrom
Conversation
Adds a test case to verify that offers with offer_currency set but offer_amount missing are correctly rejected, as required by BOLT 12 specification section "Requirements For Offers": "if `offer_currency` is set and `offer_amount` is not set: - MUST NOT respond to the offer."
|
Thanks. |
t-bast
approved these changes
Aug 19, 2025
thomash-acinq
added a commit
to ACINQ/eclair
that referenced
this pull request
Aug 19, 2025
Adds check and corresponding test from lightning/bolts#1279
Collaborator
|
@rustyrussell could you fix this on the |
24 tasks
24 tasks
25 tasks
24 tasks
Collaborator
|
I think this PR is ready to go, but since it found a bug in |
Rusty is taking some well deserved PTO but this is definitely on the list for 5 Jan! Thanks for your patience @t-bast |
26 tasks
rustyrussell
added a commit
to rustyrussell/lightning
that referenced
this pull request
Jan 4, 2026
Should fail: see lightning/bolts#1279 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Collaborator
|
Fixed, and ack 96938ce Thanks! |
rustyrussell
added a commit
to rustyrussell/lightning
that referenced
this pull request
Jan 30, 2026
Should fail: see lightning/bolts#1279 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
rustyrussell
added a commit
to ElementsProject/lightning
that referenced
this pull request
Feb 3, 2026
Should fail: see lightning/bolts#1279 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During differential fuzzing between C-lightning and rust-lightning, discovered that C-lightning incorrectly accepts offers with offer_currency set but offer_amount missing, while rust-lightning rejects them.
The BOLT 12 specification states in "Requirements For Offers":
This pr adds a test vector for the invalid offer:
lno1qcp4256ypgx9getnwss8vetrw3hhyuckyypwa3eyt44h6txtxquqh7lz5djge4afgfjn7k4rgrkuag0jsd5xvxgWhich contains CURRENCY=USD but no amount field, and should be rejected by all compliant implementations.
I got this test vector from:
https://github.com/ElementsProject/lightning/blob/c3362b057c2174589024254f4cab9eb8d955a26f/common/test/run-bolt12-encode-test.c#L439