mirror of
https://github.com/ACINQ/eclair.git
synced 2025-03-13 19:37:35 +01:00
Remove feature graph validation in payment request
Due to changes in the features system (#1253), feature graph
validation would fail with legacy 1.0.1 Phoenix wallet. This check
should be disabled as long as there are 1.0.1 Phoenix wallet in
the wild.
(cherry picked from commit 9f8f8e43ac
)
This commit is contained in:
parent
19b600e2be
commit
5ef4edb348
2 changed files with 7 additions and 5 deletions
|
@ -45,8 +45,8 @@ case class PaymentRequest(prefix: String, amount: Option[MilliSatoshi], timestam
|
|||
amount.foreach(a => require(a > 0.msat, s"amount is not valid"))
|
||||
require(tags.collect { case _: PaymentRequest.PaymentHash => }.size == 1, "there must be exactly one payment hash tag")
|
||||
require(tags.collect { case PaymentRequest.Description(_) | PaymentRequest.DescriptionHash(_) => }.size == 1, "there must be exactly one description tag or one description hash tag")
|
||||
private val featuresErr = validateFeatureGraph(features.bitmask)
|
||||
require(featuresErr.isEmpty, featuresErr.map(_.message))
|
||||
// Phoenix special case: we do not check the graph to be able to pay legacy 1.0.1 Phoenix wallets.
|
||||
// todo: add the check back once most 1.0.1 phoenix wallet have been upgraded
|
||||
if (features.allowPaymentSecret) {
|
||||
require(tags.collect { case _: PaymentRequest.PaymentSecret => }.size == 1, "there must be exactly one payment secret tag when feature bit is set")
|
||||
}
|
||||
|
|
|
@ -372,10 +372,12 @@ class PaymentRequestSpec extends FunSuite {
|
|||
PaymentRequest.read("lnbc1230p1pwljzn3pp5qyqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqdq52dhk6efqd9h8vmmfvdjs9qypqsqylvwhf7xlpy6xpecsnpcjjuuslmzzgeyv90mh7k7vs88k2dkxgrkt75qyfjv5ckygw206re7spga5zfd4agtdvtktxh5pkjzhn9dq2cqz9upw7")
|
||||
)
|
||||
|
||||
// Phoenix special case: ignore payment secret invoice validation
|
||||
// todo: reinstate this assert once legacy 1.0.1 Phoenix wallet have been upgraded
|
||||
// A multi-part invoice must use a payment secret.
|
||||
assertThrows[IllegalArgumentException](
|
||||
PaymentRequest(Block.LivenetGenesisBlock.hash, Some(123 msat), ByteVector32.One, priv, "MPP without secrets", features = Some(Features(BasicMultiPartPayment.optional, VariableLengthOnion.optional)))
|
||||
)
|
||||
// assertThrows[IllegalArgumentException](
|
||||
// PaymentRequest(Block.LivenetGenesisBlock.hash, Some(123 msat), ByteVector32.One, priv, "MPP without secrets", features = Some(Features(BasicMultiPartPayment.optional, VariableLengthOnion.optional)))
|
||||
// )
|
||||
}
|
||||
|
||||
test("trampoline") {
|
||||
|
|
Loading…
Add table
Reference in a new issue