Skip to content

fix: handle cjit channel ready notification#787

Draft
jvsena42 wants to merge 3 commits intomasterfrom
fix/channelready-cjit
Draft

fix: handle cjit channel ready notification#787
jvsena42 wants to merge 3 commits intomasterfrom
fix/channelready-cjit

Conversation

@jvsena42
Copy link
Member

@jvsena42 jvsena42 commented Feb 17, 2026

Fixes #666

This PR:

  1. Adds a NotifyChannelReady CQRS command and handler to process CJIT payment notifications when a JIT channel becomes ready
  2. Fixes missing payment notification for CJIT payments received via the foreground service when the app is in background
  3. Refactors AppViewModel.notifyChannelReady() to use the new handler, consolidating duplicated CJIT logic

Description

When a CJIT payment arrives as a JIT channel opening, LDK emits ChannelReady (not PaymentReceived). The foreground service (LightningNodeService) only handled PaymentReceived and OnchainTransactionReceived, so CJIT payments were silently ignored. The background path (WakeNodeWorker) already handled this correctly.

The new NotifyChannelReadyHandler encapsulates channel lookup, CJIT verification via Blocktank, activity recording, and notification building. It follows the same CQRS pattern as the existing NotifyPaymentReceivedHandler.

Preview

QA Notes

1. CJIT notification via foreground service

  1. Enable background notifications (foreground service)
  2. Move the app to background
  3. Send a CJIT payment (first Lightning payment that opens a new channel)
  4. Verify the "Payment Received" notification appears
  5. Tap the notification and verify the transaction sheet shows the correct amount

2. CJIT notification via push (WakeNodeWorker)

  1. Close the app completely
  2. Send a CJIT payment
  3. Verify the push notification arrives and shows the correct amount
  4. This path should still work as before (regression check)

3. Non-CJIT channel opening

  1. Open a regular (non-CJIT) Lightning channel
  2. Verify the "Spending balance ready" toast appears (not a payment notification)

4. Unit tests

  • ./gradlew testDevDebugUnitTest --tests NotifyChannelReadyHandlerTest — 6 tests pass
  • ./gradlew testDevDebugUnitTest — all tests pass
  • ./gradlew detekt — no new lint issues

@jvsena42 jvsena42 self-assigned this Feb 17, 2026
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.

Payment Received notification didn't work for CJIT via FG service (not CJIT), app in BG

1 participant