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:
@@ -73,11 +73,17 @@ class LndRestWallet(Wallet):
|
||||
amount: int,
|
||||
memo: Optional[str] = None,
|
||||
description_hash: Optional[bytes] = None,
|
||||
unhashed_description: Optional[bytes] = None,
|
||||
**kwargs,
|
||||
) -> InvoiceResponse:
|
||||
data: Dict = {"value": amount, "private": True}
|
||||
if description_hash:
|
||||
data["description_hash"] = base64.b64encode(description_hash).decode(
|
||||
"ascii"
|
||||
)
|
||||
elif unhashed_description:
|
||||
data["description_hash"] = base64.b64encode(
|
||||
hashlib.sha256(description_hash).digest()
|
||||
hashlib.sha256(unhashed_description).digest()
|
||||
).decode("ascii")
|
||||
else:
|
||||
data["memo"] = memo or ""
|
||||
|
||||
Reference in New Issue
Block a user