async def cancel_hold_invoice(self, payment_hash: str, wallet: Abstract_Wallet = None) -> dict:
        """
        Cancels lightning hold invoice 'payment_hash'.

        arg:str:payment_hash:Payment hash in hex of the hold invoice
        """
        assert payment_hash in wallet.lnworker.payment_info, \
            f"Couldn't find lightning invoice for payment hash {payment_hash}"
        assert payment_hash in wallet.lnworker._preimages, "Nothing to cancel, no known preimage."
        assert payment_hash in wallet.lnworker.dont_settle_htlcs, "Is already settled!"
        del wallet.lnworker._preimages[payment_hash]
        # set to PR_UNPAID so it can get deleted
        wallet.lnworker.set_payment_status(bfh(payment_hash), PR_UNPAID)
        wallet.lnworker.delete_payment_info(payment_hash)
        wallet.set_label(payment_hash, None)
        while wallet.lnworker.is_accepted_mpp(bfh(payment_hash)):
            # wait until the htlcs got failed so the payment won't get settled accidentally in a race
            await asyncio.sleep(0.1)
        del wallet.lnworker.dont_settle_htlcs[payment_hash]
        result = {
            "cancelled": payment_hash
        }
        return result

        Cancels lightning hold invoice 'payment_hash'.

        arg:str:payment_hash:Payment hash in hex of the hold invoice
        
electrum/commands.py