def get_invoice_status(self, invoice: BaseInvoice):
        """Returns status of (incoming) request or (outgoing) invoice."""
        # lightning invoices can be paid onchain
        if invoice.is_lightning() and self.lnworker:
            status = self.lnworker.get_invoice_status(invoice)
            if status != PR_UNPAID:
                return self.check_expired_status(invoice, status)
        paid, conf = self.is_onchain_invoice_paid(invoice)
        if not paid:
            if isinstance(invoice, Invoice):
                if status := invoice.get_broadcasting_status():
                    return status
            status = PR_UNPAID
        elif conf == 0:
            status = PR_UNCONFIRMED
        else:
            assert conf >= 1, conf
            status = PR_PAID
        return self.check_expired_status(invoice, status)
Returns status of (incoming) request or (outgoing) invoice.
electrum/wallet.py