From a41954d841ba58537043ddbc98e9cdb410004306 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 26 Nov 2023 19:09:06 +0000 Subject: [PATCH] Remove now-redundant checks in BOLT12 `Invoice` fallback addresses Now that we use the `rust-bitcoin` `WitnessProgram` to check our addresses, we can just rely on it, rather than checking the program length and version. --- lightning/src/offers/invoice.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index d0e866b2..02d68b63 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -926,20 +926,11 @@ impl InvoiceContents { }; let program = &address.program; - if program.len() < 2 || program.len() > 40 { - return None; - } - let witness_program = match WitnessProgram::new(version, program.clone()) { Ok(witness_program) => witness_program, Err(_) => return None, }; - let address = Address::new(network, Payload::WitnessProgram(witness_program)); - if !address.is_spend_standard() && version == WitnessVersion::V0 { - return None; - } - - Some(address) + Some(Address::new(network, Payload::WitnessProgram(witness_program))) }; self.fields().fallbacks -- 2.30.2