core-lightning/plugins
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
..
.gitignore plugins/.gitignore: Add fundchannel entry 2019-09-17 21:05:51 +02:00
autoclean.c plugins/libplugin: hook support 2019-12-09 16:18:28 +01:00
fundchannel.c funding: enable push_msat 2019-12-24 12:04:01 -06:00
libplugin.c Use dedicated type for error codes 2020-01-31 06:02:47 +00:00
libplugin.h Use dedicated type for error codes 2020-01-31 06:02:47 +00:00
Makefile addr: handle P2SH/P2PKH in scriptpubkey encoding 2019-11-13 03:31:20 +00:00
pay.c Use dedicated type for error codes 2020-01-31 06:02:47 +00:00
README.md doc: fix wording in plugins/README.md 2020-01-06 12:57:59 +01:00

Plugin Directory

Any file in this directory which is executable and whose name only consists of alphanumeric characters, space, '.', '-' or '_' will be automatically loaded when lightningd starts (unless suppressed with commandline options).