core-lightning/lightningd
Mark Beckwith 7f437715d5 Added error code parameter to command_fail
Until now, `command_fail()` reported an error code of -1 for all uses.
This PR adds an `int code` parameter to `command_fail()`, requiring the
caller to explicitly include the error code.

This is part of #1464.

The majority of the calls are used during parameter validation and
their error code is now JSONRPC2_INVALID_PARAMS.

The rest of the calls report an error code of LIGHTNINGD, which I defined to
-1 in `jsonrpc_errors.h`.  The intention here is that as we improve our error
reporting, all occurenaces of LIGHTNINGD will go away and we can eventually
remove it.

I also converted calls to `command_fail_detailed()` that took a `NULL` `data`
parameter to use the new `command_fail()`.

The only difference from an end user perspecive is that bad input errors that
used to be -1 will now be -32602 (JSONRPC2_INVALID_PARAMS).
2018-05-26 12:17:36 +02:00
..
test channel_control: Forget if unconfirmed for a long time and we are fundee. 2018-05-23 14:37:32 -07:00
.gitignore handshaked: remove. 2017-10-20 18:31:32 +02:00
bitcoind.c Support debugging with lldb 2018-04-15 17:42:24 +02:00
bitcoind.h Add --bitcoin-rpcport option to pass to bitcoin-rpc 2018-03-25 23:17:36 +02:00
chaintopology.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
chaintopology.h channel_control: Forget if unconfirmed for a long time and we are fundee. 2018-05-23 14:37:32 -07:00
channel.c lightningd: move "tell gossipd peer is no longer important" to drop_to_chain. 2018-04-26 05:47:57 +00:00
channel.h channel, opening_control: Make first_blocknum u32 2018-05-23 14:37:32 -07:00
channel_control.c options: Add --dev-max-funding-unconfirmed-blocks. 2018-05-23 14:37:32 -07:00
channel_control.h channel_control: Forget if unconfirmed for a long time and we are fundee. 2018-05-23 14:37:32 -07:00
channel_state.h channel_states: fold all the ONCHAIND states into one. 2018-02-23 18:02:00 +01:00
closing_control.c lightningd: move "tell gossipd peer is no longer important" to drop_to_chain. 2018-04-26 05:47:57 +00:00
closing_control.h gossipd: drain fd instead of passing around gossip index. 2018-04-26 05:47:57 +00:00
connect_control.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
connect_control.h gossipd: keep reaching struct only when we're actively connecting, and don't retry 2018-04-26 05:47:57 +00:00
dev_ping.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
gossip_control.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
gossip_control.h gossipd: separate init and activate. 2018-04-30 12:01:36 +02:00
gossip_msg.c routing: clean up channel public/active states. 2018-05-10 21:35:53 +02:00
gossip_msg.h routing: clean up channel public/active states. 2018-05-10 21:35:53 +02:00
hsm_control.c hsmd: drop newdir logic. 2018-05-05 17:55:10 +02:00
hsm_control.h hsmd: drop newdir logic. 2018-05-05 17:55:10 +02:00
htlc_end.c Remove unused parameter ptr in corrupt(const void *ptr, ...) 2018-02-22 10:46:30 +01:00
htlc_end.h htlc: keep channel pointer, not peer pointer. 2018-02-14 11:31:58 +01:00
invoice.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
invoice.h invoices: Extensive reorganization of invoice system. 2018-01-16 13:03:54 +01:00
json.c wireaddr: new type, ADDR_INTERNAL_FORPROXY, use it if we can't/wont resolve. 2018-05-11 09:15:54 +00:00
json.h gossipd/lightningd: use wireaddr_internal. 2018-05-07 22:37:28 +02:00
jsonrpc.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
jsonrpc.h Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
jsonrpc_errors.h Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
lightningd.c options: Add --dev-max-funding-unconfirmed-blocks. 2018-05-23 14:37:32 -07:00
lightningd.h options: Add --dev-max-funding-unconfirmed-blocks. 2018-05-23 14:37:32 -07:00
log.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
log.h common/daemon: common routines for all daemons. 2018-04-03 14:03:28 +02:00
log_status.c status: make status_io a more generic mechanism. 2018-05-10 02:28:44 +00:00
log_status.h status: add multiple levels of logging. 2018-02-07 00:46:49 +00:00
Makefile lightningd: make --commit-time in milliseconds. 2018-05-20 02:32:42 +00:00
memdump.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
onchain_control.c subd: record which ones connect to a peer. 2018-04-26 05:47:57 +00:00
onchain_control.h onchaind: Replay stored channeltxs to restore onchaind state 2018-04-25 14:33:38 +02:00
opening_control.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
opening_control.h gossipd/lightningd: use wireaddr_internal. 2018-05-07 22:37:28 +02:00
options.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
options.h hsmd: drop newdir logic. 2018-05-05 17:55:10 +02:00
pay.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
pay.h pay: Let sendpay modify the recorded msatoshi of payments. 2018-03-30 15:40:32 +02:00
payalgo.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
payalgo.h payalgo: New file for pay command. 2018-02-16 13:08:29 +01:00
peer_control.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
peer_control.h gossipd/gossip_constants.h: Single place for BOLT constants. 2018-05-19 15:52:56 -04:00
peer_htlcs.c Added error code parameter to command_fail 2018-05-26 12:17:36 +02:00
peer_htlcs.h channel_control: Forget if unconfirmed for a long time and we are fundee. 2018-05-23 14:37:32 -07:00
subd.c lighningd: Remove --debug-subdaemon-io. 2018-05-20 02:32:42 +00:00
subd.h subd: record which ones connect to a peer. 2018-04-26 05:47:57 +00:00
watch.c topo: Remove in-memory txs from the block struct 2018-04-13 00:04:37 +02:00
watch.h topo: Remove in-memory txs from the block struct 2018-04-13 00:04:37 +02:00