mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 10:39:49 +01:00
55173a56b7
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
1.1 KiB
1.1 KiB
lightning-waitinvoice -- Command for waiting for specific payment
SYNOPSIS
waitinvoice label
DESCRIPTION
The waitinvoice RPC command waits until a specific invoice is paid, then returns that single entry as per listinvoice.
RETURN VALUE
On success, an invoice description will be returned as per lightning-listinvoice(7). The status field will be paid.
On error the returned object will contain code
and message
properties,
with code
being one of the following:
- -32602: If the given parameters are wrong.
- -1: If the invoice is deleted while unpaid, or the invoice does not exist.
- 903: If the invoice expires before being paid, or is already expired.
AUTHOR
Christian Decker <decker.christian@gmail.com> is mainly responsible.
SEE ALSO
lightning-waitanyinvoice(7), lightning-listinvoice(7), lightning-delinvoice(7), lightning-invoice(7)
RESOURCES
Main web site: https://github.com/ElementsProject/lightning