mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-16 13:01:04 +02:00
Fix tor proxy for c-lightning and fix bytes to hex for pay req fields
This commit is contained in:
parent
de58e9e824
commit
4fd61971c5
2 changed files with 8 additions and 5 deletions
|
|
@ -30,6 +30,7 @@ services:
|
|||
- --log-level=debug
|
||||
- --rpc-file=/root/.lightning/lightning-rpc
|
||||
- --rpc-file-mode=0777
|
||||
- --proxy=tor-node:9050
|
||||
|
||||
volumes:
|
||||
# shared volume is needed for sharing the btcd certificate
|
||||
|
|
|
|||
|
|
@ -52,18 +52,20 @@ class CLightningClient(LightningClient):
|
|||
def pay_invoice(self, payment_request: str) -> Payment:
|
||||
pay_req = self.decode_pay_req(payment_request)
|
||||
logger.info('decoded pay_req: {}'.format(pay_req))
|
||||
route = self.lrpc.getroute(pay_req.destination, 100, 1)
|
||||
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,
|
||||
pay_req.payment_hash.hex(),
|
||||
)
|
||||
logger.info('payment: {}'.format(payment))
|
||||
completed_payment = self.lrpc.waitsendpay(
|
||||
route['route'],
|
||||
pay_req.payment_hash,
|
||||
pay_req.payment_hash.hex(),
|
||||
)
|
||||
if completed_payment['status'] == 'complete':
|
||||
return Payment(
|
||||
payment_preimage=payment['payment_preimage'],
|
||||
payment_preimage=bytes.fromhex(payment['payment_preimage']),
|
||||
payment_error='',
|
||||
)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue