Skip to content

Commit d4db681

Browse files
committed
decode
1 parent 98cc265 commit d4db681

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/OfferTypes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ object OfferTypes {
318318
* An offer string can be split with '+' to fit in places with a low character limit. This validates that the string adheres to the spec format to guard against copy-pasting errors.
319319
* @return a lowercase string with '+' and whitespaces removed
320320
*/
321-
def validateFormat(s: String): String = {
321+
private def validateFormat(s: String): String = {
322322
val lowercase = s.toLowerCase
323323
require(s == lowercase || s == s.toUpperCase)
324324
require(lowercase.head == 'l')

eclair-core/src/test/scala/fr/acinq/eclair/wire/protocol/OfferTypesSpec.scala

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,8 @@ class OfferTypesSpec extends AnyFunSuite {
328328
val src = Source.fromFile(new File(getClass.getResource(s"/format-string-test.json").getFile))
329329
val testVectors = JsonMethods.parse(src.mkString).extract[Seq[FormatTestVector]]
330330
src.close()
331-
val canonical = testVectors.head.string
332331
for (vector <- testVectors) {
333-
if (vector.valid) {
334-
assert(Offer.validateFormat(vector.string) == canonical, vector.comment)
335-
} else {
336-
assertThrows[IllegalArgumentException](Offer.validateFormat(vector.string))
337-
}
332+
assert(Offer.decode(vector.string).isSuccess == vector.valid, vector.comment)
338333
}
339334
}
340335
}

0 commit comments

Comments
 (0)