File tree Expand file tree Collapse file tree 2 files changed +61
-23
lines changed
commonMain/kotlin/fr/acinq/lightning/payment
commonTest/kotlin/fr/acinq/lightning/payment Expand file tree Collapse file tree 2 files changed +61
-23
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,10 @@ data class PaymentRequest(
248248 fun decodeAmount (input : String ): MilliSatoshi ? {
249249 val amount = when {
250250 input.isEmpty() -> null
251- input.last() == ' p' -> MilliSatoshi (input.dropLast(1 ).toLong() / 10L )
251+ input.last() == ' p' -> {
252+ require(input.endsWith(" 0p" )) { " invalid sub-millisatoshi precision" }
253+ MilliSatoshi (input.dropLast(1 ).toLong() / 10L )
254+ }
252255 input.last() == ' n' -> MilliSatoshi (input.dropLast(1 ).toLong() * 100L )
253256 input.last() == ' u' -> MilliSatoshi (input.dropLast(1 ).toLong() * 100000L )
254257 input.last() == ' m' -> MilliSatoshi (input.dropLast(1 ).toLong() * 100000000L )
You can’t perform that action at this time.
0 commit comments