diff --git a/phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/components/AmountInput.kt b/phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/components/AmountInput.kt index 866342726..8f6842b61 100644 --- a/phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/components/AmountInput.kt +++ b/phoenix-android/src/main/kotlin/fr/acinq/phoenix/android/components/AmountInput.kt @@ -134,7 +134,10 @@ object AmountInputHelper { onConverted(context.getString(R.string.utils_no_conversion)) null } else { - val msat = amount.toMilliSatoshi(rate.price) + // convert fiat amount to millisat, but truncate the msat part to avoid issues with + // services/wallets that don't understand millisats. We only do this when converting + // from fiat. If amount is in btc, we use the real value entered by the user. + val msat = amount.toMilliSatoshi(rate.price).truncateToSatoshi().toMilliSatoshi() if (msat.toUnit(BitcoinUnit.Btc) > 21e6) { onError(context.getString(R.string.send_error_amount_too_large)) null diff --git a/phoenix-shared/src/commonMain/kotlin/fr.acinq.phoenix/managers/LnurlManager.kt b/phoenix-shared/src/commonMain/kotlin/fr.acinq.phoenix/managers/LnurlManager.kt index 57ad41783..223d8d499 100644 --- a/phoenix-shared/src/commonMain/kotlin/fr.acinq.phoenix/managers/LnurlManager.kt +++ b/phoenix-shared/src/commonMain/kotlin/fr.acinq.phoenix/managers/LnurlManager.kt @@ -110,6 +110,7 @@ class LnurlManager( // SPECS: LN WALLET verifies that the amount in the provided invoice equals the amount previously specified by user. if (amount != invoice.paymentRequest.amount) { + log.error { "rejecting invoice from $origin with amount_invoice=${invoice.paymentRequest.amount} requested_amount=$amount" } throw LnurlError.Pay.Invoice.InvalidAmount(origin) }