Skip to content

Commit c247d6d

Browse files
committed
Allow uppercase bech32 HRP
Previously, we would fail parsing `Offer`s if the HRP didn't match our expected (lowercase) HRP. Here, we relax this check in accordance with the spec to also allow all-uppercase HRPs.
1 parent 66f794c commit c247d6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/offers/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ mod sealed {
5858

5959
let parsed = CheckedHrpstring::new::<NoChecksum>(encoded.as_ref())?;
6060
let hrp = parsed.hrp();
61-
if hrp.as_str() != Self::BECH32_HRP {
61+
if (hrp.as_str() != Self::BECH32_HRP) && (hrp.as_str().to_lowercase() != Self::BECH32_HRP) {
6262
return Err(Bolt12ParseError::InvalidBech32Hrp);
6363
}
6464

0 commit comments

Comments
 (0)