Commit Graph

62 Commits

Author SHA1 Message Date
Rusty Russell cd90c8408c lightningd/gossip: clean up channel resolve failure handling.
We were getting an assert "!secp256k1_fe_is_zero(&ge->x)", because
an all-zero pubkey is invalid.  We allow marshal/unmarshal of NULL for
now, and clean up the error handling.

1. Use status_failed if master sends a bad message.
2. Similarly, kill the gossip daemon if it gives a bad reply.
3. Use an array for returned pubkeys: 0 or 2.
4. Use type_to_string(trc, struct short_channel_id, &scid) for tracing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-05 16:11:44 +09:30
Rusty Russell d072f2ec06 wire: understand struct preimage, don't treat it as sha256.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-01 23:59:46 +10:30
Rusty Russell 9768e4c907 tools/generate-wire.py: open-code array handling for non-u8.
Except for the trivial case of u8 arrays, have the generator create
the loop code for the array iteration.

This removes some trivial helpers, and avoids us having to write more.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-16 14:35:23 +10:30
Rusty Russell 7419fde9a0 Update to new spec: differentiate channel_id and short_channel_id.
The spec 4af8e1841151f0c6e8151979d6c89d11839b2f65 uses a 32-byte 'channel-id'
field, not to be confused with the 8-byte short ID used by gossip.  Rename
appropriately, and update to the new handshake protocol.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-02 22:51:49 +10:30
Rusty Russell 7cee3b0f68 wire: sha256_double, privkey and u64/u32/bool array support.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-21 15:15:28 +10:30
Rusty Russell 1edce4878d bitcoin/signature.h: remove struct signature.
It's a wrapper around secp256k1_ecdsa_signature, so use that directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-25 11:03:55 +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 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 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 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
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