Skip to content

Commit be28931

Browse files
ben-kaufmanclaude
andcommitted
fix: remove dead fixedWithdrawAmountSat and simplify conditional
fixedWithdrawAmountSat() had no production call sites after switching to createInvoiceMsats for fixed-amount withdrawals and satsCeil for display. Remove the function, its test, and simplify the redundant displayAmount conditional. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4750afb commit be28931

3 files changed

Lines changed: 1 addition & 13 deletions

File tree

app/src/main/java/to/bitkit/ext/Lnurl.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,3 @@ fun LnurlWithdrawData.isFixedAmount(): Boolean {
5757
val min = minWithdrawable ?: 0u
5858
return min == maxWithdrawable || (min > 0u && minWithdrawableSat() > maxWithdrawableSat())
5959
}
60-
61-
/**
62-
* The amount in whole sats to use when creating a withdraw invoice for a fixed-amount request.
63-
*
64-
* Uses floor division so the invoice amount never exceeds `maxWithdrawable` in msats.
65-
*/
66-
fun LnurlWithdrawData.fixedWithdrawAmountSat(): ULong = maxWithdrawable / MSATS_PER_SAT

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1527,7 +1527,7 @@ class AppViewModel @Inject constructor(
15271527
return
15281528
}
15291529

1530-
val displayAmount = if (isFixed) data.minWithdrawableSat() else minWithdrawable
1530+
val displayAmount = minWithdrawable
15311531

15321532
_sendUiState.update {
15331533
it.copy(

app/src/test/java/to/bitkit/ext/LnurlExtTest.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@ class LnurlExtTest : BaseUnitTest() {
119119
assertEquals(false, data.isFixedAmount())
120120
}
121121

122-
@Test
123-
fun `fixedWithdrawAmountSat floors to avoid exceeding max`() {
124-
val data = withdrawData(minWithdrawable = 500_500u, maxWithdrawable = 500_500u)
125-
assertEquals(500u, data.fixedWithdrawAmountSat())
126-
}
127122

128123
private fun lnurlPayData(
129124
minSendable: ULong = 1_000u,

0 commit comments

Comments
 (0)