fix: refresh receive after payment#1086
Open
ben-kaufman wants to merge 7 commits into
Open
Conversation
ben-kaufman
marked this pull request as ready for review
July 16, 2026 12:03
ben-kaufman
force-pushed
the
codex/refresh-receive-after-payment
branch
from
July 16, 2026 14:14
4061e04 to
2a3c258
Compare
jvsena42
reviewed
Jul 20, 2026
jvsena42
left a comment
Member
There was a problem hiding this comment.
Nothing blocking so far, still haven't tested
| val settledReceiveInvoice = if (event is Event.PaymentReceived) { | ||
| val settledInvoice = invalidateSettledReceiveInvoice(event) | ||
| val paymentId = event.paymentId ?: event.paymentHash | ||
| runSuspendCatching { coreService.activity.handlePaymentEvent(paymentId) } |
Member
There was a problem hiding this comment.
AppViewModel.handlePaymentReceived still calls activityRepo.handlePaymentEvent(paymentHash). The same payment is processed twice with different keys. Is this intentional?
|
|
||
| suspend fun recordPresentation(command: NotifyPaymentReceived.Command) { | ||
| withContext(ioDispatcher) { | ||
| runSuspendCatching { markAsSeen(command) } |
Member
There was a problem hiding this comment.
nit: could remove the key from presentationClaims
Comment on lines
+115
to
+121
| if (!notifyPaymentReceivedHandler.claimPresentation(command) { App.currentActivity?.value == null }) { | ||
| return@withContext false | ||
| } | ||
| showPaymentNotification(result.sheet, result.notification) | ||
| true | ||
| } | ||
| if (presented) notifyPaymentReceivedHandler.recordPresentation(command) |
Member
There was a problem hiding this comment.
could extract this duplicated logic to a present method like:
suspend fun present(
command: NotifyPaymentReceived.Command,
canPresent: () -> Boolean = { true },
block: suspend () -> Unit,
): Boolean {
if (!claimPresentation(command, canPresent)) return false
block()
recordPresentation(command)
return true
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Preview
Not applicable; this fixes receive-state lifecycle behavior without changing the UI layout.
QA Notes
./gradlew compileDevDebugKotlin./gradlew testDevDebugUnitTest./gradlew detekt --rerun-tasks(passes with the repository baseline findings)git diff --checkAppCacheDataTest.kt,CacheStoreTest.kt,LightningRepoTest.kt,WalletRepoTest.kt,AppViewModelSendFlowTest.kt,LightningNodeServiceTest.kt, andNotifyPaymentReceivedHandlerTest.kt