Skip to content

Commit 2608e65

Browse files
ben-kaufmanclaude
andcommitted
fix: use ceiling for received payment notification amounts
WakeNodeWorker and NotifyPaymentReceivedHandler used floor division for msat amounts in payment notifications. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ae32b31 commit 2608e65

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/to/bitkit/domain/commands/NotifyPaymentReceivedHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class NotifyPaymentReceivedHandler @Inject constructor(
9797
is NotifyPaymentReceived.Command.Onchain -> command.event.txid
9898
},
9999
sats = when (command) {
100-
is NotifyPaymentReceived.Command.Lightning -> (command.event.amountMsat / 1000u).toLong()
100+
is NotifyPaymentReceived.Command.Lightning -> ((command.event.amountMsat + 999u) / 1000u).toLong()
101101
is NotifyPaymentReceived.Command.Onchain -> command.event.details.amountSats
102102
},
103103
)

app/src/main/java/to/bitkit/fcm/WakeNodeWorker.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class WakeNodeWorker @AssistedInject constructor(
192192
showDetails: Boolean,
193193
hiddenBody: String,
194194
) {
195-
val sats = event.amountMsat / 1000u
195+
val sats = (event.amountMsat + 999u) / 1000u
196196
// Save for UI to pick up
197197
cacheStore.setBackgroundReceive(
198198
NewTransactionSheetDetails(

0 commit comments

Comments
 (0)