Skip to content

Commit a41954d

Browse files
committed
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.
1 parent b28068c commit a41954d

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

lightning/src/offers/invoice.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -926,20 +926,11 @@ impl InvoiceContents {
926926
};
927927

928928
let program = &address.program;
929-
if program.len() < 2 || program.len() > 40 {
930-
return None;
931-
}
932-
933929
let witness_program = match WitnessProgram::new(version, program.clone()) {
934930
Ok(witness_program) => witness_program,
935931
Err(_) => return None,
936932
};
937-
let address = Address::new(network, Payload::WitnessProgram(witness_program));
938-
if !address.is_spend_standard() && version == WitnessVersion::V0 {
939-
return None;
940-
}
941-
942-
Some(address)
933+
Some(Address::new(network, Payload::WitnessProgram(witness_program)))
943934
};
944935

945936
self.fields().fallbacks

0 commit comments

Comments
 (0)