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>
The object file should not be built inside the submodule, as that can
confuse git.
Not everything depends on the libbase58 header (CCAN doesn't), so
move that to the everything-else depends line.
The BITCOIN_SRC etc should also move to bitcoin/Makefile, but that's
a bigger change.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
828eda61df5a7be27051c605f7808e4f690739e4, in particular, it has the
new address format for node_announcement.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
For our internal CSV files, we can specify the type explicitly rather
than trying to guess (eg. bool).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Pretty! Takes an int instead of the enum directly, because in the
main daemon we call it via a function pointer, so want them all the
same type.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
It implies tal_count() gives the length. Great for almost all callers which
don't care if there are extra bytes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This removes some redundancy in creating messages, but also allows
a lazy form or parsing without explicitly checking the type.
A helper fromwire_peektype() is added to look up the type and handle
the too-short-for-type problem.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We emit them into the generated code at appropriate points, but it
would be better if we simply preserved the order they were given in.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is a bit more awkward for large structures, but avoids
indirection for the simpler ones (I copied the structures for the test
code, however). We also remove explicit padding.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Other than being neater (no more global list to edit!), this lets the
new daemon and old daemon have their own separate routines.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The union still contains all the types, but we can only print
the ones which are linked in.
This makes it much easier to use type_to_string in different binaries
without pulling in the world.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>