@log_exceptions
async def create_invoice(self, *, amount_msat: Optional[int], message: str, expiry: int) -> Tuple[(LnAddr, str)]:
    timestamp = int(time.time())
    routing_hints = (await self._calc_routing_hints_for_invoice(amount_msat))
    if (not routing_hints):
        self.logger.info('Warning. No routing hints added to invoice. Other clients will likely not be able to send to us.')
    invoice_features = self.features.for_invoice()
    trampoline_hints = []
    for r in routing_hints:
        (node_id, short_channel_id, fee_base_msat, fee_proportional_millionths, cltv_expiry_delta) = r[1][0]
        if ((len(r[1]) == 1) and self.is_trampoline_peer(node_id)):
            trampoline_hints.append(('t', (node_id, fee_base_msat, fee_proportional_millionths, cltv_expiry_delta)))
    payment_preimage = os.urandom(32)
    payment_hash = sha256(payment_preimage)
    info = PaymentInfo(payment_hash, amount_msat, RECEIVED, PR_UNPAID)
    amount_btc = ((amount_msat / Decimal((COIN * 1000))) if amount_msat else None)
    if (expiry == 0):
        expiry = LN_EXPIRY_NEVER
    lnaddr = LnAddr(paymenthash=payment_hash, amount=amount_btc, tags=(([('d', message), ('c', MIN_FINAL_CLTV_EXPIRY_FOR_INVOICE), ('x', expiry), ('9', invoice_features)] + routing_hints) + trampoline_hints), date=timestamp, payment_secret=derive_payment_secret_from_payment_preimage(payment_preimage))
    invoice = lnencode(lnaddr, self.node_keypair.privkey)
    self.save_preimage(payment_hash, payment_preimage)
    self.save_payment_info(info)
    return (lnaddr, invoice)
@log_exceptions
async def create_invoice(self, *, amount_msat: Optional[int], message: str, expiry: int) -> Tuple[(LnAddr, str)]:
    timestamp = int(time.time())
    routing_hints = (await self._calc_routing_hints_for_invoice(amount_msat))
    if (not routing_hints):
        self.logger.info('Warning. No routing hints added to invoice. Other clients will likely not be able to send to us.')
    invoice_features = self.features.for_invoice()
    trampoline_hints = []
    for r in routing_hints:
        (node_id, short_channel_id, fee_base_msat, fee_proportional_millionths, cltv_expiry_delta) = r[1][0]
        if ((len(r[1]) == 1) and self.is_trampoline_peer(node_id)):
            trampoline_hints.append(('t', (node_id, fee_base_msat, fee_proportional_millionths, cltv_expiry_delta)))
    payment_preimage = os.urandom(32)
    payment_hash = sha256(payment_preimage)
    info = PaymentInfo(payment_hash, amount_msat, RECEIVED, PR_UNPAID)
    amount_btc = ((amount_msat / Decimal((COIN * 1000))) if amount_msat else None)
    if (expiry == 0):
        expiry = LN_EXPIRY_NEVER
    lnaddr = LnAddr(paymenthash=payment_hash, amount=amount_btc, tags=(([('d', message), ('c', MIN_FINAL_CLTV_EXPIRY_FOR_INVOICE), ('x', expiry), ('9', invoice_features)] + routing_hints) + trampoline_hints), date=timestamp, payment_secret=derive_payment_secret_from_payment_preimage(payment_preimage))
    invoice = lnencode(lnaddr, self.node_keypair.privkey)
    self.save_preimage(payment_hash, payment_preimage)
    self.save_payment_info(info)
    return (lnaddr, invoice)