Skip to content

bolt11: bugfixes and cleanup - #10970

Merged
SomberNight merged 8 commits into
spesmilo:masterfrom
f321x:fix_bolt11_bugs_2
Sep 18, 2026
Merged

SomberNight merged 8 commits into
spesmilo:masterfrom
f321x:fix_bolt11_bugs_2

Conversation

@f321x

@f321x f321x commented Sep 14, 2026

Copy link
Copy Markdown
Member

Fix some minor bugs in the bolt11.py module and remove t-tag support. See individual commits.

When truncating a description at 639 bytes it can happen that
the trailing part is now an incomplete utf-8 character.
Re-encode it and drop the broken character so a stric reader
doesn't raise on it later on.
The intended padding in `int_to_data5` was a no-op.
Don't override a date of 0 with the current date if passed
to the constructor.
When decoding a invoice with 'n' (pubkey) tag store the
pubkey also in the tags. This allows to re-encode the same
invoice exactly as it was encoded before (instead of dropping the
pubkey). Also when consumers inspect the tags for some purpose later
they might expect the pubkey to be in the tags.
When encoding a BOLT11Addr, accept an actual hash as the value of
the `h` tag (description hash).
Trampoline t-tags are unused since 196b4c0, there doesn't seem to be
any need to keep them around. Trampoline hints are encoded
in the regular routing hint r-tags now.
Don't accept bolt11 invoices with '0' amount and leading '0' digits.
Explicitly fail on sub-millisat amounts (already indirectly
enforced in amount setter).
See:
https://github.com/lightning/bolts/blob/152897261850d93c4f4597f39cf22d7d22d6ede6/11-payment-encoding.md?plain=1#L69-L70
Comment thread electrum/bolt11.py

@SomberNight SomberNight left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ACK 8c5a946.
Just a minor nit.

Comment thread electrum/bolt11.py
Through the removal of t-type routing info tags
this argument isn't neccessary anymore.
@SomberNight
SomberNight merged commit 4b92c0f into spesmilo:master Sep 18, 2026
11 checks passed
@SomberNight

Copy link
Copy Markdown
Member

thx

@f321x
f321x deleted the fix_bolt11_bugs_2 branch September 19, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants