2018-12-08 00:39:28 +00:00
|
|
|
/* common/jsonrpc_errors.h
|
2018-02-05 01:19:16 +00:00
|
|
|
* Lists error codes for JSON-RPC.
|
|
|
|
*/
|
2018-12-08 00:39:28 +00:00
|
|
|
#ifndef LIGHTNING_COMMON_JSONRPC_ERRORS_H
|
|
|
|
#define LIGHTNING_COMMON_JSONRPC_ERRORS_H
|
2020-01-26 12:52:29 +00:00
|
|
|
|
2018-02-05 01:19:16 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2020-01-26 12:52:29 +00:00
|
|
|
#include <common/errcode.h>
|
|
|
|
|
2018-02-08 21:49:35 +00:00
|
|
|
/* Standard errors defined by JSON-RPC 2.0 standard */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t JSONRPC2_INVALID_REQUEST = -32600;
|
|
|
|
static const errcode_t JSONRPC2_METHOD_NOT_FOUND = -32601;
|
|
|
|
static const errcode_t JSONRPC2_INVALID_PARAMS = -32602;
|
2018-02-05 01:19:16 +00:00
|
|
|
|
2018-05-24 22:40:18 +01:00
|
|
|
/* Uncategorized error.
|
|
|
|
* FIXME: This should be replaced in all places
|
|
|
|
* with a specific error code, and then removed.
|
|
|
|
*/
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t LIGHTNINGD = -1;
|
2018-07-28 18:34:17 +01:00
|
|
|
|
|
|
|
/* Developer error in the parameters to param() call */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t PARAM_DEV_ERROR = -2;
|
2018-05-24 22:40:18 +01:00
|
|
|
|
2018-11-26 18:54:06 +00:00
|
|
|
/* Plugin returned an error */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t PLUGIN_ERROR = -3;
|
2018-11-26 18:54:06 +00:00
|
|
|
|
2020-04-09 16:36:04 +01:00
|
|
|
/* Plugin terminated while handling a request. */
|
|
|
|
static const errcode_t PLUGIN_TERMINATED = -4;
|
|
|
|
|
2021-11-10 09:08:49 +00:00
|
|
|
/* Lightningd is shutting down while handling a request. */
|
|
|
|
static const errcode_t LIGHTNINGD_SHUTDOWN = -5;
|
|
|
|
|
2018-03-04 05:35:37 +00:00
|
|
|
/* Errors from `pay`, `sendpay`, or `waitsendpay` commands */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t PAY_IN_PROGRESS = 200;
|
|
|
|
static const errcode_t PAY_RHASH_ALREADY_USED = 201;
|
|
|
|
static const errcode_t PAY_UNPARSEABLE_ONION = 202;
|
|
|
|
static const errcode_t PAY_DESTINATION_PERM_FAIL = 203;
|
|
|
|
static const errcode_t PAY_TRY_OTHER_ROUTE = 204;
|
|
|
|
static const errcode_t PAY_ROUTE_NOT_FOUND = 205;
|
|
|
|
static const errcode_t PAY_ROUTE_TOO_EXPENSIVE = 206;
|
|
|
|
static const errcode_t PAY_INVOICE_EXPIRED = 207;
|
|
|
|
static const errcode_t PAY_NO_SUCH_PAYMENT = 208;
|
|
|
|
static const errcode_t PAY_UNSPECIFIED_ERROR = 209;
|
|
|
|
static const errcode_t PAY_STOPPED_RETRYING = 210;
|
2020-08-08 16:47:53 +01:00
|
|
|
static const errcode_t PAY_STATUS_UNEXPECTED = 211;
|
2020-12-14 01:20:44 +00:00
|
|
|
static const errcode_t PAY_OFFER_INVALID = 212;
|
2018-02-03 11:46:12 +00:00
|
|
|
|
2018-06-15 17:45:06 +01:00
|
|
|
/* `fundchannel` or `withdraw` errors */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t FUND_MAX_EXCEEDED = 300;
|
|
|
|
static const errcode_t FUND_CANNOT_AFFORD = 301;
|
|
|
|
static const errcode_t FUND_OUTPUT_IS_DUST = 302;
|
|
|
|
static const errcode_t FUNDING_BROADCAST_FAIL = 303;
|
|
|
|
static const errcode_t FUNDING_STILL_SYNCING_BITCOIN = 304;
|
|
|
|
static const errcode_t FUNDING_PEER_NOT_CONNECTED = 305;
|
|
|
|
static const errcode_t FUNDING_UNKNOWN_PEER = 306;
|
2020-06-24 05:34:26 +01:00
|
|
|
static const errcode_t FUNDING_NOTHING_TO_CANCEL = 307;
|
|
|
|
static const errcode_t FUNDING_CANCEL_NOT_SAFE = 308;
|
2020-09-03 19:01:45 +01:00
|
|
|
static const errcode_t FUNDING_PSBT_INVALID = 309;
|
|
|
|
static const errcode_t FUNDING_V2_NOT_SUPPORTED = 310;
|
2020-09-17 21:28:46 +01:00
|
|
|
static const errcode_t FUNDING_UNKNOWN_CHANNEL = 311;
|
2021-01-20 01:40:01 +00:00
|
|
|
static const errcode_t FUNDING_STATE_INVALID = 312;
|
2018-06-15 17:45:06 +01:00
|
|
|
|
2020-01-05 17:17:25 +00:00
|
|
|
/* `connect` errors */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t CONNECT_NO_KNOWN_ADDRESS = 400;
|
|
|
|
static const errcode_t CONNECT_ALL_ADDRESSES_FAILED = 401;
|
2020-01-05 17:17:25 +00:00
|
|
|
|
2020-01-02 20:04:03 +00:00
|
|
|
/* bitcoin-cli plugin errors */
|
|
|
|
#define BCLI_ERROR 400
|
|
|
|
|
2020-07-19 10:04:03 +01:00
|
|
|
/* Errors from `invoice` or `delinvoice` commands */
|
2020-01-26 12:52:29 +00:00
|
|
|
static const errcode_t INVOICE_LABEL_ALREADY_EXISTS = 900;
|
|
|
|
static const errcode_t INVOICE_PREIMAGE_ALREADY_EXISTS = 901;
|
|
|
|
static const errcode_t INVOICE_HINTS_GAVE_NO_ROUTES = 902;
|
|
|
|
static const errcode_t INVOICE_EXPIRED_DURING_WAIT = 903;
|
|
|
|
static const errcode_t INVOICE_WAIT_TIMED_OUT = 904;
|
2020-07-19 10:04:03 +01:00
|
|
|
static const errcode_t INVOICE_NOT_FOUND = 905;
|
|
|
|
static const errcode_t INVOICE_STATUS_UNEXPECTED = 906;
|
2020-12-14 01:21:48 +00:00
|
|
|
static const errcode_t INVOICE_OFFER_INACTIVE = 907;
|
2018-04-26 08:42:04 +01:00
|
|
|
|
2020-02-04 05:53:17 +00:00
|
|
|
/* Errors from HSM crypto operations. */
|
|
|
|
static const errcode_t HSM_ECDH_FAILED = 800;
|
|
|
|
|
2020-12-14 01:21:19 +00:00
|
|
|
/* Errors from `offer` commands */
|
|
|
|
static const errcode_t OFFER_ALREADY_EXISTS = 1000;
|
|
|
|
static const errcode_t OFFER_ALREADY_DISABLED = 1001;
|
2020-12-16 03:18:00 +00:00
|
|
|
static const errcode_t OFFER_EXPIRED = 1002;
|
|
|
|
static const errcode_t OFFER_ROUTE_NOT_FOUND = 1003;
|
2020-12-16 03:18:20 +00:00
|
|
|
static const errcode_t OFFER_BAD_INVREQ_REPLY = 1004;
|
2021-01-07 18:39:47 +00:00
|
|
|
static const errcode_t OFFER_TIMEOUT = 1005;
|
2020-12-14 01:21:19 +00:00
|
|
|
|
2021-08-25 03:51:04 +01:00
|
|
|
/* Errors from datastore command */
|
|
|
|
static const errcode_t DATASTORE_DEL_DOES_NOT_EXIST = 1200;
|
|
|
|
static const errcode_t DATASTORE_DEL_WRONG_GENERATION = 1201;
|
|
|
|
static const errcode_t DATASTORE_UPDATE_ALREADY_EXISTS = 1202;
|
|
|
|
static const errcode_t DATASTORE_UPDATE_DOES_NOT_EXIST = 1203;
|
|
|
|
static const errcode_t DATASTORE_UPDATE_WRONG_GENERATION = 1204;
|
2021-08-25 03:51:34 +01:00
|
|
|
static const errcode_t DATASTORE_UPDATE_HAS_CHILDREN = 1205;
|
|
|
|
static const errcode_t DATASTORE_UPDATE_NO_CHILDREN = 1206;
|
2021-08-25 03:51:04 +01:00
|
|
|
|
2021-01-06 15:22:34 +00:00
|
|
|
/* Errors from wait* commands */
|
|
|
|
static const errcode_t WAIT_TIMEOUT = 2000;
|
|
|
|
|
2018-12-08 00:39:28 +00:00
|
|
|
#endif /* LIGHTNING_COMMON_JSONRPC_ERRORS_H */
|