Commit Graph

323 Commits

Author SHA1 Message Date
Rusty Russell a10ea23e0d wire: add ccan/io helpers to send (unencrypted) messages between damones.
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>
2017-01-10 15:22:20 +10:30
Rusty Russell 9d316e39cd wire/wire_sync: helper routines for direct read/write of messages.
Some of the simple daemons want to use this, as do the status messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:21:20 +10:30
Rusty Russell 42f474af18 wire: make lengths of variable fields implied by tal_count()
This is a much nicer interface, and works better in practice too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:19:25 +10:30
Rusty Russell 71ab218ed8 test/run-peer-wire.c: fix for variable-length reason field in update_fail_htlc
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-06 13:58:39 +10:30
Rusty Russell af2ad72c50 wire: update peer CSV file.
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>
2017-01-06 13:40:35 +10:30
Rusty Russell d8feec2197 wire: split onion messages from peer wire messages.
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>
2017-01-06 13:40:35 +10:30
Christian Decker 96af89139e base58: Unittests need in-tree libbase58 2017-01-05 12:12:30 +10:30
Rusty Russell bdc4972df6 wire/gen_peer_wire_csv: update to latest spec #2
828eda61df5a7be27051c605f7808e4f690739e4, in particular, it has the
new address format for node_announcement.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:21 +10:30
Rusty Russell d3bdb073b5 wire/gen_peer_wire_csv: update to latest spec #1
In particular, add features bitfields.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:21 +10:30
Rusty Russell f50af430e1 wire: add bool routines.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:21 +10:30
Rusty Russell e076d56709 generate-wire.py: include type bytes in towire/fromwire routines.
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>
2017-01-04 14:09:21 +10:30
Rusty Russell c864b28068 generate-wire.py: don't generate structures, hand in all values.
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>
2017-01-04 14:09:20 +10:30
Rusty Russell a08a2105ea generate-wire.py: generalize, move to tools.
We're going to want to use this for inter-daemon comms, so generalize it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:20 +10:30
Rusty Russell b7789bf065 Makefile: generalize whitespace check.
Spread to individual Makefiles, and include headers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:20 +10:30
Rusty Russell 0861ec33a5 check-source-bolt: generalize.
This way sub-Makefiles can add their own files to check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:20 +10:30
Rusty Russell 6dc7056625 check-bolt: use new BOLTs.
The structure is slightly different, so this requires some fixes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:09:20 +10:30
Christian Decker 6363dd5ff6 gossip: Update to new spec version
The message type numbering changed, so reflect that in the generated
type listing.
2017-01-03 15:08:05 +10:30
Christian Decker 811fab4850 trivial: Add `addresses` field to generate-wire.py
It was failing the compile if we had a recent enough spec.
2017-01-03 14:48:54 +10:30
Rusty Russell a4fdaab5b3 Use global secp256k1_ctx instead of passing it around.
If I'd known how large this patch would be (though trivial), I'd
have done it in parts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:12:58 +10:30
Rusty Russell c938ebb5c0 utils: add a global secp, fix wire to use it.
This repairs make check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:11:06 +10:30
Christian Decker ca9fb0376a wire: Removing global secpctx
Changed the generation of messages so that we pass in a reference to the
secp256k1_context if it is required by the underlying primitive
function. This gets rid of the global `secp256k1_ctx` variable and
adheres closer to how we've been handing in the context so far.
2016-12-01 13:50:02 +10:30
Christian Decker e40509c6c3 wire: Linking against wire objs 2016-12-01 13:50:02 +10:30
Rusty Russell 36e018161f wire: generate marshal/unmarshal from spec.
Including tests!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-01 13:50:02 +10:30