tbolt11 invoice: strip (and so accept with) leading/trailing whitespaces - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 2fab6814442ee843ab1271d2c83a873c1ea4b6f4
DIR parent 660d7d137c99c3fe974d0528e5a1f76445463dcb
HTML Author: SomberNight <somber.night@protonmail.com>
Date: Mon, 2 Mar 2020 19:32:53 +0100
bolt11 invoice: strip (and so accept with) leading/trailing whitespaces
Diffstat:
M electrum/util.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
---
DIR diff --git a/electrum/util.py b/electrum/util.py
t@@ -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