From: Matt Corallo Date: Sun, 26 Nov 2023 19:09:06 +0000 (+0000) Subject: Remove now-redundant checks in BOLT12 `Invoice` fallback addresses X-Git-Tag: v0.0.119~46^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2F2023-11-bitcoin-0.30-followups;p=rust-lightning 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. --- diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index d0e866b2f..02d68b635 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