support description_hash across all APIs.

This commit is contained in:
fiatjaf
2020-07-03 20:04:04 -03:00
parent 61f736878c
commit bc27293315
10 changed files with 89 additions and 45 deletions
+8 -2
View File
@@ -23,7 +23,7 @@ class LndWallet(Wallet):
self.auth_read = getenv("LND_READ_MACAROON")
self.auth_cert = getenv("LND_CERT")
def create_invoice(self, amount: int, memo: str = "") -> InvoiceResponse:
def create_invoice(self, amount: int, memo: str = "", description_hash: bytes = b"") -> InvoiceResponse:
lnd_rpc = lnd_grpc.Client(
lnd_dir=None,
macaroon_path=self.auth_invoice,
@@ -33,7 +33,13 @@ class LndWallet(Wallet):
grpc_port=self.port,
)
lndResponse = lnd_rpc.add_invoice(memo=memo, value=amount, expiry=600, private=True)
lndResponse = lnd_rpc.add_invoice(
memo=memo,
description_hash=base64.b64encode(description_hash).decode("ascii"),
value=amount,
expiry=600,
private=True,
)
decoded_hash = base64.b64encode(lndResponse.r_hash).decode("utf-8").replace("/", "_")
print(lndResponse.r_hash)
ok, checking_id, payment_request, error_message = True, decoded_hash, str(lndResponse.payment_request), None