core-lightning/tools
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
..
gen json-rpc: Don't let users send messages that are handled internally 2020-01-28 23:50:52 +01:00
test tools: add ability to wrap wire messages with ifs 2019-10-10 05:57:45 +00:00
bench-gossipd.sh gossipd: remove unnecessary dev_unknown_channel_satoshis arg. 2019-05-22 11:28:44 +00:00
build-release.sh doc/MAKING-RELEASES.md: update. 2019-08-19 03:43:13 +00:00
check-bolt.c check-bolt: escape { and }. 2019-09-22 01:17:11 +00:00
check-includes.sh devtools/create-gossipstore: clean up enough to pass check-source. 2019-04-08 04:41:43 +00:00
check-manpage.sh doc/Makefile: adapt 'check-manpages' to markdown 2019-08-22 01:35:01 +00:00
check-markdown.sh tools: use /usr/bin/env bash instead of /bin/bash 2018-07-24 00:25:43 +00:00
check-setup_locale.sh tools/check-setup_locale.sh: don't get caught by main in non-C files. 2019-02-08 01:10:17 +00:00
check-spelling.sh spelling: Check LockTime Verify. 2018-10-23 16:55:35 +02:00
docker-entrypoint.sh [Docker] Make sure lightningd receive SIGTERM 2018-12-29 13:29:54 +01:00
generate-wire.py Use dedicated type for error codes 2020-01-31 06:02:47 +00:00
headerversions.c tools: Add missing unistd.h header 2018-12-29 13:34:23 +01:00
hsmtool.c hsmtool: Make the backup copy in the same directory as the original 2020-01-13 08:55:32 +08:00
Makefile tool/hsmtool: add a 'guesstoremote' command 2019-11-29 21:19:05 +01:00
mockup.sh build: fix developer mode compilation on FreeBSD 2020-01-02 16:56:20 +01:00
refresh-submodules.sh build: allow building from source zip file. 2019-01-15 02:18:30 +00:00
rel.sh tools: use /usr/bin/env bash instead of /bin/bash 2018-07-24 00:25:43 +00:00
repro-build.sh remove libbase58, use base58 from libwally (#2594) 2019-04-30 23:07:31 +02:00
update-mocks.sh build: fix developer mode compilation on FreeBSD 2020-01-02 16:56:20 +01:00