Skip to content

Commit

Permalink
Update Bolt11 test vectors (#293)
Browse files Browse the repository at this point in the history
We now match the spec once lightning/bolts#898
is merged.
  • Loading branch information
t-bast authored Sep 22, 2021
1 parent 9dfee75 commit da7b603
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ data class PaymentRequest(
fun decodeAmount(input: String): MilliSatoshi? {
val amount = when {
input.isEmpty() -> null
input.last() == 'p' -> MilliSatoshi(input.dropLast(1).toLong() / 10L)
input.last() == 'p' -> {
require(input.endsWith("0p")) { "invalid sub-millisatoshi precision" }
MilliSatoshi(input.dropLast(1).toLong() / 10L)
}
input.last() == 'n' -> MilliSatoshi(input.dropLast(1).toLong() * 100L)
input.last() == 'u' -> MilliSatoshi(input.dropLast(1).toLong() * 100000L)
input.last() == 'm' -> MilliSatoshi(input.dropLast(1).toLong() * 100000000L)
Expand Down
Loading

0 comments on commit da7b603

Please sign in to comment.