Skip to content

Conversation

@jklein24
Copy link

@jklein24 jklein24 commented Jan 22, 2026

Per BOLT 11 spec, readers "MUST skip over f fields that use an unknown version" and "versions 19-31 will be ignored by readers."

https://github.com/lightning/bolts/blob/master/11-payment-encoding.md#rationale-2

The context is that Spark embeds a fallback spark address with version 31 which should be ignored by lightning implementations as per the BOLT11 spec, but instead nlightning is throwing an error when parsing a spark lightning invoice.

Previously, FallbackAddressTaggedField.FromBitReader threw an exception for unknown address versions. Now it returns null, which the existing TaggedFieldList already handles by skipping the field.

Changes:

  • Return null instead of throwing for unknown versions (1-16, 19-31)
  • Update return type to FallbackAddressTaggedField?
  • Add tests for unknown version handling
  • Add Assert.NotNull to existing tests for nullable return type

Per BOLT 11 spec, readers "MUST skip over `f` fields that use an
unknown `version`" and "versions 19-31 will be ignored by readers."

Previously, FallbackAddressTaggedField.FromBitReader threw an exception
for unknown address versions. Now it returns null, which the existing
TaggedFieldList already handles by skipping the field.

Changes:
- Return null instead of throwing for unknown versions (1-16, 19-31)
- Update return type to FallbackAddressTaggedField?
- Add tests for unknown version handling
- Add Assert.NotNull to existing tests for nullable return type

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant