The problem with wire headers not being generated in time before stuff
depended on it turns out to be related with inclusion order of
sub-makefiles. The inclusions must preceed the use of
LIGHTNINGD_HEADERS since they append to that variable.
Now we hand peers off to the gossip daemon, to do the INIT handshake and
re-transmit/receive gossip. They may stay there forever if neither we nor
them wants to open a channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
It's a bit messy, since some status messages are accompanied by an FD:
in this case, the handler returns STATUS_NEED_FD and we read that then
re-call the handler.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
These use the same infrastructure as the daemon/test blackbox tests,
so they're not currently wired into make check; use make
"lightningd-blackbox-tests".
We'll assert if we try: better to truncate, trace a warning, and let the
recipient complain about a truncated message,
This is particularly an issue when we're sending encapsulated messages;
this avoids extra checks in the caller.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The API formalizes how daemons should report their statuses back to
the main lightningd. It's a simple write API, which includes tracing
support (currently it always sends traces, later it could send iff
there's a failure, for example).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Format is "le16 len; u8 message[len]" same as wire format specified in
BOLTs, even though the endian conversion is overkill for local messages.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Before we had a global secp256k1_ctx we needed to hold this to print
out pubkeys, now it's completely orthogonal.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Setting the environment variable `COVERAGE=1` allows us to turn
coverage measurements on. This produces a number of auxiliary gcno and
gcda files which can then be converted into coverage reports.
I know line coverage and branch coverage is not a perfect metric, but
it might get us some more visibility into where more tests might be
needed.
So far it was failing silently, now it diffs the Makefile state
against the directory listing. This also fixes a bug when the locale
was not set the sort order would not match.
This is from my fix-peer-numbering branch (without that, the code
won't compile due to dup numbers) and temporarily removes the
alignment check (fails due to sha256 in update_fail_malformed_htlc,
which will be fixed in my onion-failmsg-cleanup branch.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The recent update to BOLT #4 includes failure message specifications,
which are completely orthogonal to the normal ones. Don't include
them in the gen_peer_wire_csv.
This onion_defs.h file assumes we are using 2-byte failure codes as per
the onion-failmsg-cleanup branch.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This lets us marshal and unmarshal undefined complex types; the fromwire
function will allocate it for us, so we don't even need to know the size.
This turns out to be really nice for marshalling 'struct crypto_state'.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>