def send_to_route_generator(invoice, route): i = 0 while i < 1: request = ln.SendToRouteRequest(payment_hash=invoice.r_hash, routes=route) yield request i += 1
def send_to_route_generator(invoices, route): i = 0 j = len(invoices) while i < j: for invoice in invoices: request = ln.SendToRouteRequest(payment_hash=invoice.r_hash, routes=route) yield request i += 1
def send_to_route_sync(self, routes, **kwargs): """ a synchronous version of SendToRoute. It Will block until the payment either fails or succeeds. :return: SendResponse with up to 4 attributes: 'payment_error' (conditional), 'payment_preimage', 'payment_route' and 'payment_hash' """ request = ln.SendToRouteRequest(routes=routes, **kwargs) response = self.lightning_stub.SendToRouteSync(request) return response
def send_to_route_generator(invoice, routes): """ create SendToRouteRequest generator :return: generator of SendToRouteRequest """ # Commented out to complement the magic sleep below... # while True: request = ln.SendToRouteRequest(payment_hash=invoice.r_hash, routes=routes) yield request # Magic sleep which tricks the response to the send_to_route() method to actually # contain data... time.sleep(5)
def send_to_route_sync(self, routes: ln.Route, **kwargs): request = ln.SendToRouteRequest(routes=routes, **kwargs) response = self.lightning_stub.SendToRouteSync(request) return response