Wallets/unhashed_description (#870)

* new argument: unhashed_description

* accept in api

* set unhashed_description for memo case

* bolt11.py: dont be like CLN, accept the hash

* send hash to lnd in b64

* fix cln

* skip descr_hash for cln

* skip

* format
This commit is contained in:
calle
2022-08-13 14:29:04 +02:00
committed by GitHub
parent 3457ff101e
commit e5d8c500d2
16 changed files with 101 additions and 21 deletions
+10 -3
View File
@@ -46,12 +46,19 @@ class ClicheWallet(Wallet):
amount: int,
memo: Optional[str] = None,
description_hash: Optional[bytes] = None,
unhashed_description: Optional[bytes] = None,
) -> InvoiceResponse:
if description_hash:
description_hash_hashed = hashlib.sha256(description_hash).hexdigest()
if unhashed_description or description_hash:
description_hash_str = (
description_hash.hex()
if description_hash
else hashlib.sha256(unhashed_description).hexdigest()
if unhashed_description
else None
)
ws = create_connection(self.endpoint)
ws.send(
f"create-invoice --msatoshi {amount*1000} --description_hash {description_hash_hashed}"
f"create-invoice --msatoshi {amount*1000} --description_hash {description_hash_str}"
)
r = ws.recv()
else: