{
  "$schema": "../rpc-schema-draft.json",
  "type": "object",
  "rpc": "dev-forget-channel",
  "title": "Command to remove the DB entries from the database after a close",
  "warning": "For advanced users only",
  "description": [
    "Never use any `dev` command, including this one, unless you know exactly what you are doing; and have checked with a developer that your understanding is correct. They are meant only as a means of last resort and have the potential to mess things up. You have been warned❗️",
    "",
    "The **dev-forget-channel** forgets the channel with given details. It will perform additional checks on whether it is safe to forget the channel, and only then remove the channel from the DB. Notice that this command is only available if CLN was started with --developer.",
    "",
    "Also see https://docs.corelightning.org/docs/faq#how-to-forget-about-a-channel"
  ],
  "request": {
    "required": [
      "id"
    ],
    "additionalProperties": false,
    "properties": {
      "id": {
        "type": "pubkey",
        "description": [
          "The peer id of the channel to be forgotten. Checks if the channel is still active by checking its funding transaction."
        ]
      },
      "short_channel_id": {
        "type": "short_channel_id",
        "description": [
          "The short channel id of the channel you want to remove."
        ]
      },
      "channel_id": {
        "type": "hash",
        "description": [
          "The channel id of the channel you want to remove."
        ]
      },
      "force": {
        "type": "boolean",
        "description": [
          "Ignores UTXO check for forced removal."
        ],
        "default": "False"
      }
    }
  },
  "response": {
    "required": [
      "forced",
      "funding_unspent",
      "funding_txid"
    ],
    "additionalProperties": false,
    "properties": {
      "forced": {
        "type": "boolean",
        "description": [
          "If the command was forced or not."
        ]
      },
      "funding_unspent": {
        "type": "boolean",
        "description": [
          "The funding is spent or not in the channel."
        ]
      },
      "funding_txid": {
        "type": "txid",
        "description": [
          "The id of the funding transaction."
        ]
      }
    }
  },
  "errors": [
    "The following errors may be reported:",
    "",
    "- -32602: If the given parameters are missing or wrong.",
    "- -1: Catch all nonspecific errors, eg. `Multiple channels: please specify short_channel_id.` OR `No channels matching that peer_id and that short_channel_id.`, etc."
  ],
  "author": [
    "Rusty Russell [rusty@rustcorp.com.au](mailto:rusty@rustcorp.com.au) is mainly responsible."
  ],
  "see_also": [
    "lightning-close(7)",
    "lightning-listchannels(7)",
    "lightning-listpeerchannels(7)",
    "lightning-listfunds(7)"
  ],
  "resources": [
    "Main web site: [https://github.com/ElementsProject/lightning](https://github.com/ElementsProject/lightning)"
  ],
  "examples": [
    {
      "description": [
        "Forget a channel by peer pubkey when only one channel exists with the peer:"
      ],
      "request": {
        "id": "example:dev-forget-channel#1",
        "method": "dev-forget-channel",
        "params": {
          "id": "nodeid050505050505050505050505050505050505050505050505050505050505"
        }
      },
      "response": {
        "forced": false,
        "funding_unspent": false,
        "funding_txid": "fundingtxid00101010101010101010101010101010101010101010101010101"
      }
    },
    {
      "description": [
        "Forget a channel by short channel id when peer has multiple channels:"
      ],
      "request": {
        "id": "example:dev-forget-channel#2",
        "method": "dev-forget-channel",
        "params": {
          "id": "nodeid030303030303030303030303030303030303030303030303030303030303",
          "short_channel_id": "111x1x1",
          "force": true
        }
      },
      "response": {
        "forced": true,
        "funding_unspent": false,
        "funding_txid": "fundingtxid00202020202020202020202020202020202020202020202020202"
      }
    }
  ]
}
