예제 #1
0
    def get_rebalance_invoice(self, memo):
        """
        Creates a zero amount invoice and gives back it's hash.

        :param memo: Comment for the invoice.
        :return: Hash of the invoice preimage.
        """
        invoice = self._rpc.AddInvoice(lnd.Invoice(value=0, memo=memo))
        return invoice.r_hash
예제 #2
0
    def get_invoice(self, amt_msat, memo):
        """
        Creates a new invoice with amt_msat and memo.

        :param amt_msat: int
        :param memo: str
        :return: Hash of invoice preimage.
        """
        invoice = self._rpc.AddInvoice(
            lnd.Invoice(value=amt_msat // 1000, memo=memo))
        return invoice.r_hash
예제 #3
0
    def self_payment(self, routes, amt_msat):
        """
        Do a self-payment along routes with amt_msat.

        :param routes: list of :class:`lib.route.Route` objects
        :param amt_msat:
        :return: payment result
        """
        invoice = self._rpc.AddInvoice(lnd.Invoice(value=amt_msat // 1000))
        result = self.send_to_route(routes, invoice.r_hash)
        logger.debug(result)
        return result
예제 #4
0
    def self_payment_zero_invoice(self, routes, memo):
        """
        Do a self-payment along routes with an invoice of zero satoshis.
        This helps to use one invoice for several rebalancing attempts.
        Adds a memo to the invoice, which can later be parsed for bookkeeping.

        :param routes: list of :class:`lib.route.Route` objects
        :param memo: str, Comment field for an invoice.
        :return: payment result
        """
        invoice = self._rpc.AddInvoice(lnd.Invoice(value=0, memo=memo))
        result = self.send_to_route(routes, invoice.r_hash)
        logger.debug(result)
        return result