mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-13 12:33:25 +02:00
Got pay invoice working with c-lightning
This commit is contained in:
parent
4fd61971c5
commit
ecf677f570
1 changed files with 2 additions and 13 deletions
|
|
@ -50,20 +50,9 @@ class CLightningClient(LightningClient):
|
|||
pass
|
||||
|
||||
def pay_invoice(self, payment_request: str) -> Payment:
|
||||
pay_req = self.decode_pay_req(payment_request)
|
||||
logger.info('decoded pay_req: {}'.format(pay_req))
|
||||
logger.info('pay_req.destination: {}'.format(pay_req.destination))
|
||||
route = self.lrpc.getroute(pay_req.destination, pay_req.num_msat, 1)
|
||||
logger.info('route: {}'.format(route))
|
||||
payment = self.lrpc.sendpay(
|
||||
route['route'],
|
||||
pay_req.payment_hash.hex(),
|
||||
)
|
||||
payment = self.lrpc.pay(payment_request)
|
||||
logger.info('payment: {}'.format(payment))
|
||||
completed_payment = self.lrpc.waitsendpay(
|
||||
pay_req.payment_hash.hex(),
|
||||
)
|
||||
if completed_payment['status'] == 'complete':
|
||||
if payment['status'] == 'complete':
|
||||
return Payment(
|
||||
payment_preimage=bytes.fromhex(payment['payment_preimage']),
|
||||
payment_error='',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue