Skip to content

list_transactions: fall back to extra.comment / memo when BOLT11 description is empty#43

Merged
blackcoffeexbt merged 2 commits into
lnbits:mainfrom
bitcoin3us:fix/list-transactions-comment-fallback
Jun 2, 2026
Merged

list_transactions: fall back to extra.comment / memo when BOLT11 description is empty#43
blackcoffeexbt merged 2 commits into
lnbits:mainfrom
bitcoin3us:fix/list-transactions-comment-fallback

Conversation

@bitcoin3us

Copy link
Copy Markdown

Closes #42.

Summary

_on_list_transactions returns description: None for LNURL-pay payments because the BOLT11 description is a SHA-256 hash (LUD-06 description_hash), not human text. The actual content lives in:

  • payment.extra.comment — the payer's LUD-12 message
  • payment.memo — the Pay Link's "Item description"

…both of which list_transactions was ignoring. lookup_invoice already falls back to payment.memo; this PR mirrors that, plus prefers LUD-12 comments when present.

Change

One field's value, in tasks.py _on_list_transactions:

"description": (
    (p.extra or {}).get("comment")     # LUD-12 payer-supplied message
    or invoice_data.description        # BOLT11 description (when human text, not hash)
    or p.memo                          # Pay Link item description / generic memo
),

Ordering rationale — when a payer typed a message via LUD-12, that's more informative for the receiver than the receiver's own Pay Link template. Falls back through both other sources for non-LUD-12 incoming payments and for outgoing ones, matching the existing _on_lookup_invoice shape.

Test plan

  • Read against the divergent _on_lookup_invoice body (line ~356) — fallback chain is consistent with what lookup already does, plus the extra.comment source.
  • Local LNBits dev env: install the change, send a comment-bearing LUD-12 payment to a Lightning Address, confirm description in list_transactions response equals the payer's comment string.
  • Same flow with no comment: confirm fallback to invoice_data.description (if present) or p.memo.
  • Outgoing payment (pay_invoice): confirm description still populates from invoice_data.description / p.memo.

Happy to run any additional tests the maintainer wants. Verified on Lightning Piggy (ESP32 NWC display wallet, github.com/LightningPiggy/LightningPiggyApp) against an LNBits instance: with this change, payer-supplied comments now appear in the on-device transaction list; without it, every LNURL-pay row reads as bare-amount.

…ription is empty

LNURL-pay payments use a SHA-256 description_hash, so invoice_data.description
is None/empty and the LUD-12 payer comment + Pay Link item description never
reach the NWC client. The new fallback chain — extra.comment → invoice_data.description → memo —
matches what _on_lookup_invoice already does, plus prefers LUD-12 comments
when present. Closes lnbits#42.

@riccardobl riccardobl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good! Thanks!

@blackcoffeexbt blackcoffeexbt merged commit 0204f8f into lnbits:main Jun 2, 2026
5 of 7 checks passed
DoktorShift added a commit to DoktorShift/nwcprovider that referenced this pull request Jun 2, 2026
- resolve tasks.py conflict (align with upstream lnbits#43)
- keep comment fallback in lookup_invoice (null-safe)
DoktorShift added a commit to DoktorShift/nwcprovider that referenced this pull request Jun 2, 2026
- resolve tasks.py conflict (align with upstream lnbits#43)
- restore poetry.lock
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.

list_transactions drops payer comments (LUD-12) and Pay Link memos

3 participants