fix(wallet): keep self-send legs distinct + deterministic tx order#586
Open
dmnyc wants to merge 1 commit into
Open
fix(wallet): keep self-send legs distinct + deterministic tx order#586dmnyc wants to merge 1 commit into
dmnyc wants to merge 1 commit into
Conversation
A self-payment surfaces as two transaction records sharing one payment hash — one outgoing, one incoming. Port the iOS WalletStore.dedupTransactions hardening so they render correctly: - Add dedupTransactions(): drop exact (paymentHash, type) repeats the backend returns, and sort newest-first with the incoming "received" leg above its outgoing "sent" leg on a timestamp tie. Apply on initial load, re-enrich, and load-more. - Key the transaction LazyColumn by "paymentHash|type" so the two legs of a self-send keep distinct identities and both render (mirrors iOS WalletTransaction.id).
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.
Summary
A self-payment (e.g. paying your own lightning address) surfaces in the wallet provider's transaction list as two records sharing one payment hash — one outgoing leg and one incoming leg. Two problems followed on Android:
LazyColumn { items(transactions) }falls back to identity equality. Because both legs share the samepaymentHashand equal in most other fields, Compose treated them as the same item and only rendered one.This PR ports the iOS
WalletStore.dedupTransactionshardening so Android matches.Changes
WalletViewModel.kt— addsdedupTransactions():(paymentHash, type)repeats the backend returnsWalletScreen.kt— keys the transactionLazyColumnby"$paymentHash|$type"so the two legs of a self-send keep distinct Compose identities and both render. Mirrors iOSWalletTransaction.id.Verified on device
Before: NWC wallet self-send pair rendered with the sent leg above the received leg (opposite of Spark).
After: both wallets show received above sent for self-send pairs, and both legs are visible.
(Screenshots in the comment that triggered this fix.)
Reference
iOS:
WalletStore.swift→dedupTransactions+WalletTransaction.id.