Skip to content

Conversation

@erickcestari
Copy link
Contributor

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":

if offer_currency is set and offer_amount is not set:

  • MUST NOT respond to the offer.

This pr adds a test vector for the invalid offer:
lno1qcp4256ypgx9getnwss8vetrw3hhyuckyypwa3eyt44h6txtxquqh7lz5djge4afgfjn7k4rgrkuag0jsd5xvxg

Which 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

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."
@thomash-acinq
Copy link

Thanks.
Eclair too fails this test, I've fixed it in ACINQ/eclair#3140.

Copy link
Collaborator

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

ACK 96938ce

thomash-acinq added a commit to ACINQ/eclair that referenced this pull request Aug 19, 2025
@t-bast
Copy link
Collaborator

t-bast commented Sep 17, 2025

@rustyrussell could you fix this on the cln side and verify this test vector?

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

ACK 96938ce

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