Skip to content

Commit 6e770e0

Browse files
committed
Remove old lastLightningPaymentId
1 parent 948f963 commit 6e770e0

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

app/src/main/java/to/bitkit/data/CacheStore.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ class CacheStore @Inject constructor(
9898
}
9999
}
100100

101-
suspend fun setLastLightningPayment(paymentId: String) {
102-
store.updateData { it.copy(lastLightningPaymentId = paymentId) }
103-
}
104-
105101
suspend fun setBackgroundReceive(details: NewTransactionSheetDetails) = store.updateData {
106102
it.copy(backgroundReceive = details)
107103
}
@@ -130,7 +126,6 @@ data class AppCacheData(
130126
val balance: BalanceState? = null,
131127
val backupStatuses: Map<BackupCategory, BackupItemStatus> = mapOf(),
132128
val deletedActivities: List<String> = listOf(),
133-
val lastLightningPaymentId: String? = null,
134129
val pendingBoostActivities: List<PendingBoostActivity> = listOf(),
135130
val backgroundReceive: NewTransactionSheetDetails? = null,
136131
) {

app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -373,20 +373,8 @@ class AppViewModel @Inject constructor(
373373

374374
private suspend fun notifyPaymentReceived(event: Event) {
375375
val command = NotifyPaymentReceived.Command.from(event) ?: return
376-
if (command is NotifyPaymentReceived.Command.Lightning) {
377-
val cachedId = cacheStore.data.first().lastLightningPaymentId
378-
// Skip if this is a replay by ldk-node on startup
379-
if (command.event.paymentHash == cachedId) {
380-
Logger.debug("Skipping notification for replayed event: $event", context = TAG)
381-
return
382-
}
383-
// Cache to skip later as needed
384-
cacheStore.setLastLightningPayment(command.event.paymentHash)
385-
}
386-
387376
val result = notifyPaymentReceivedHandler(command).getOrNull()
388377
if (result !is NotifyPaymentReceived.Result.ShowSheet) return
389-
390378
showTransactionSheet(result.sheet)
391379
}
392380

0 commit comments

Comments
 (0)