Browse Source
bolt11 invoice: strip (and so accept with) leading/trailing whitespaces
hard-fail-on-bad-server-string
SomberNight
5 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
1 changed files with
6 additions and
5 deletions
-
electrum/util.py
|
|
@ -930,11 +930,12 @@ def create_bip21_uri(addr, amount_sat: Optional[int], message: Optional[str], |
|
|
|
|
|
|
|
|
|
|
|
def maybe_extract_bolt11_invoice(data: str) -> Optional[str]: |
|
|
|
lower = data.lower() |
|
|
|
if lower.startswith('lightning:ln'): |
|
|
|
lower = lower[10:] |
|
|
|
if lower.startswith('ln'): |
|
|
|
return lower |
|
|
|
data = data.strip() # whitespaces |
|
|
|
data = data.lower() |
|
|
|
if data.startswith('lightning:ln'): |
|
|
|
data = data[10:] |
|
|
|
if data.startswith('ln'): |
|
|
|
return data |
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|