core-lightning/connectd
Vasil Dimov 55173a56b7 Use dedicated type for error codes
Before this patch we used `int` for error codes. The problem with
`int` is that we try to pass it to/from wire and the size of `int` is
not defined by the standard. So a sender with 4-byte `int` would write
4 bytes to the wire and a receiver with 2-byte `int` (for example) would
read just 2 bytes from the wire.

To resolve this:

* Introduce an error code type with a known size:
  `typedef s32 errcode_t`.

* Change all error code macros to constants of type `errcode_t`.
  Constants also play better with gdb - it would visualize the name of
  the constant instead of the numeric value.

* Change all functions that take error codes to take the new type
  `errcode_t` instead of `int`.

* Introduce towire / fromwire functions to send / receive the newly added
  type `errcode_t` and use it instead of `towire_int()`.

In addition:

* Remove the now unneeded `towire_int()`.

* Replace a hardcoded error code `-2` with a new constant
  `INVOICE_EXPIRED_DURING_WAIT` (903).

Changelog-Changed: The waitinvoice command would now return error code 903 to designate that the invoice expired during wait, instead of the previous -2
2020-01-31 06:02:47 +00:00
..
test common: allow subdaemons to specify the node_id in status messages. 2019-11-18 04:50:22 +00:00
connect_gossip_wire.csv wire-gen: move in-house wire delcarations to new format 2019-07-24 06:31:46 +00:00
connect_wire.csv Use dedicated type for error codes 2020-01-31 06:02:47 +00:00
connectd.c Use dedicated type for error codes 2020-01-31 06:02:47 +00:00
connectd.h common/features: only support a single feature bitset. 2019-10-11 02:52:04 +00:00
handshake.c transition from status_trace() to status_debug 2019-09-10 02:02:51 +00:00
handshake.h channeld: use pointer for shared secret. 2019-01-08 19:20:28 +01:00
Makefile common: use struct onionreply. 2020-01-23 16:17:42 +10:30
netaddress.c transition from status_trace() to status_debug 2019-09-10 02:02:51 +00:00
netaddress.h gossipd: move files into connectd. 2018-07-25 02:13:52 +00:00
peer_exchange_initmsg.c connectd: return error when no common chain at init 2019-12-28 14:22:05 +01:00
peer_exchange_initmsg.h Use node_id everywhere for nodes. 2019-04-09 12:37:16 -07:00
tor_autoservice.c Add the missing space between "if" and "(" 2020-01-06 12:57:59 +01:00
tor_autoservice.h Init commit to be able to create a tor static service on the fly. 2019-12-03 23:35:18 +01:00
tor.c Minor source code style change of comments. 2020-01-10 17:53:31 +01:00
tor.h connectd: rename 'struct reaching' to 'struct connecting'. 2018-09-28 04:14:28 +00:00