fix: handle cjit channel ready notification#787
Conversation
There was a problem hiding this comment.
tAck
Tests
1. 🟢 CJIT notification via foreground service
nit: we miss currency formatting (space separators for thousands)
2. 🟠 CJIT notification via push (WakeNodeWorker)
Got 2 notifications now, I don't think this used to be the case before (🤔 ❓). Anyways ideally we only show the 2nd one, it's much more polished IMO.
3. 🔴 Non-CJIT channel opening
There's something totally off here, not sure what happened…
Logs: bitkit_logs_1771958898408.zip
PS. Bummer that we have these bugs, because the way the code is architected is really nice 👏🏻 .
| val converted = currencyRepo.convertSatsToFiat(sats).getOrNull() | ||
|
|
||
| val amountText = converted?.let { | ||
| val btcDisplay = it.bitcoinDisplay(settings.displayUnit) |
There was a problem hiding this comment.
nit: we will have to create a model class for AmountUi to encapsulate all requirements related to displaying monetary values so we can easily replicate enforcing the same rules with minimal effort.
There's a concern not yet covered here but also not in scope of this PR, TBH: we don't format currency symbol applying the same formatting rule of whether the symbol is a prefix of a suffix based on the currencies' symbol locale, as recently implemented for the main in-app amount values UI by @piotr-iohk
Pull request was converted to draft
Fixes #666
Closes #626
This PR:
NotifyChannelReadyCQRS command and handler to process CJIT payment notifications when a JIT channel becomes readyAppViewModel.notifyChannelReady()to use the new handler, consolidating duplicated CJIT logicDescription
When a CJIT payment arrives as a JIT channel opening, LDK emits
ChannelReady(notPaymentReceived). The foreground service (LightningNodeService) only handledPaymentReceivedandOnchainTransactionReceived, so CJIT payments were silently ignored. The background path (WakeNodeWorker) already handled this correctly.The new
NotifyChannelReadyHandlerencapsulates channel lookup, CJIT verification via Blocktank, activity recording, and notification building. It follows the same CQRS pattern as the existingNotifyPaymentReceivedHandler.Preview
fg-notification.webm
wake-2.webm
QA Notes
1. CJIT notification via foreground service
2. CJIT notification via push (WakeNodeWorker)
3. Non-CJIT channel opening
4. Unit tests
./gradlew testDevDebugUnitTest --tests NotifyChannelReadyHandlerTest— 6 tests pass./gradlew testDevDebugUnitTest— all tests pass./gradlew detekt— no new lint issues