Skip to content

fix: Cashu payment notes not showing in Activity and stale note state on success view#3856

Merged
kaloudis merged 2 commits intoZeusLN:masterfrom
kaloudis:fix-cashu-payment-notes
Mar 21, 2026
Merged

fix: Cashu payment notes not showing in Activity and stale note state on success view#3856
kaloudis merged 2 commits intoZeusLN:masterfrom
kaloudis:fix-cashu-payment-notes

Conversation

@kaloudis
Copy link
Copy Markdown
Contributor

@kaloudis kaloudis commented Mar 18, 2026

Description

Relates to issue: ZEUS-3838

Root Cause

After the migration from cashu-ts to CDK (Cashu Dev Kit), the Activity view was sourcing outgoing Cashu payments from cdkPayments — transaction objects returned by CDK's native listTransactions() API. CDK assigns its own internal transaction IDs (64-char hex hashes), which are completely unrelated to the invoice's payment_hash that the note was saved under.

The flow was:

  1. User pays → note saved under key note-<invoice_payment_hash> (e.g., note-5300bdf4...)
  2. Activity view loads CDK transactions → each has CDK's internal ID as its payment_hash (e.g., 208227c3...)
  3. Activity computes note key → note-208227c3...doesn't match the saved note

The mint's quote IDs (base64url strings like JPYH0VzsApUnqy_DiA7a0Z0ZYKznjqht53RcCf-p) and CDK's internal transaction IDs (hex hashes like 208227c3e4dcfef1521c613fb3829c619371bf23f11c0e882e89b0d4154e6644) are two entirely different ID systems — there is no way to match between them.

Fix

The Activity view now uses this.payments (the app's own stored payment records) for outgoing Cashu payments instead of cdkPayments (CDK's transaction history). We already persist a CashuPayment to local storage after each successful payment in payLnInvoiceFromEcash, carrying the bolt11 invoice and payment_hash from the original decoded invoice. These are loaded back on startup. Since the stored payments have the real invoice payment_hash, getNoteKey resolves to the same key that was used when saving the note.

Note: cdkInvoices is still used for incoming (receive) transactions, since completed incoming invoices are only available from CDK's transaction history — unlike outgoing payments, which we store ourselves.

This eliminated the need for cdkPayments, the fromCDKTransaction factory method on CashuPayment, all CDK transaction fields on the model (fromCDK, cdkTimestamp, cdkAmount, cdkMemo, cdkState), and the CDK-specific branches in the model's computed getters — a net simplification.

The stale "Update Note" issue is fixed by resetting noteKey in resetPaymentState and clearing storedNotes in the CashuSendingLightning focus listener when noteKey is absent.

PR Type

This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Configuration change
  • Locales update
  • Quality assurance
  • Other

Checklist

  • I’ve run yarn run tsc and made sure my code compiles correctly
  • I’ve run yarn run lint and made sure my code didn’t contain any problematic patterns
  • I’ve run yarn run prettier and made sure my code is formatted correctly
  • I’ve run yarn run test and made sure all of the tests pass

Testing

If you modified or added a utility file, did you add new unit tests?

  • No, I’m a fool
  • Yes
  • N/A

I have tested this PR on the following platforms (please specify OS version and phone model/VM):

  • Android
  • iOS

I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):

  • Embedded LND
  • LND (REST)
  • LND (Lightning Node Connect)
  • Core Lightning (CLNRest)
  • Nostr Wallet Connect
  • LndHub

Locales

  • I’ve added new locale text that requires translations
  • I’m aware that new translations should be made on the ZEUS Transfix page and not directly to this repo

Third Party Dependencies and Packages

  • Contributors will need to run yarn after this PR is merged in
  • 3rd party dependencies have been modified:
    • verify that package.json and yarn.lock have been properly updated
    • verify that dependencies are installed for both iOS and Android platforms

Other:

  • Changes were made that require an update to the README
  • Changes were made that require an update to onboarding

@kaloudis kaloudis added this to the v0.13.0 milestone Mar 18, 2026
@kaloudis kaloudis requested a review from shubhamkmr04 March 18, 2026 03:10
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves critical issues affecting the visibility and state management of Cashu payments within the application. It ensures that all Cashu transactions are correctly displayed in the activity feed and that the user interface for creating new notes behaves as expected, preventing misleading 'Update note' prompts on initial creation. The changes enhance the reliability and user experience of Cashu functionalities.

Highlights

  • Activity View Visibility: Fixed an issue where Cashu payment notes created from CashuSendingLightning were not appearing in the Activity view due to a mismatch in transaction IDs.
  • Note Key Resolution: Implemented a mechanism to match CDK transactions with stored payments, resolving the original payment_hash to correctly generate note keys for Cashu payments.
  • Stale Note State: Addressed a bug where 'Update note' incorrectly appeared on first creation by ensuring the noteKey is reset in the resetPaymentState function.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where Cashu payment notes were not appearing in the Activity view and fixes a stale note state on the success view. The changes involve modifying the CashuPayment model to resolve the original invoice payment hash, updating the CashuStore to reset the note key, and adjusting the CashuSendingLightning view to handle cases where the note key is missing. Overall, the changes improve the reliability and user experience of Cashu payments.

Comment thread views/Cashu/CashuSendingLightning.tsx Outdated
Comment thread models/CashuPayment.ts Outdated
@kaloudis kaloudis force-pushed the fix-cashu-payment-notes branch from aac2a6e to 11e857f Compare March 18, 2026 03:24
Copy link
Copy Markdown
Contributor

@shubhamkmr04 shubhamkmr04 left a comment

Choose a reason for hiding this comment

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

I still can't see the notes created on CashuSendingLightning in the activity.

@kaloudis kaloudis requested a review from shubhamkmr04 March 19, 2026 04:24
@kaloudis kaloudis force-pushed the fix-cashu-payment-notes branch from 43767bd to 2a7d373 Compare March 20, 2026 22:31
@kaloudis kaloudis force-pushed the fix-cashu-payment-notes branch from 2a7d373 to c8868ce Compare March 20, 2026 22:38
Copy link
Copy Markdown
Contributor

@shubhamkmr04 shubhamkmr04 left a comment

Choose a reason for hiding this comment

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

tACK

@kaloudis kaloudis merged commit ffe2234 into ZeusLN:master Mar 21, 2026
4 checks passed
@kaloudis kaloudis deleted the fix-cashu-payment-notes branch March 21, 2026 04:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cashu: notes created from CashuSendingLightning don't appear in Activity view

2 participants