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>
This commit is contained in:
Rusty Russell
2017-03-02 22:51:49 +10:30
parent 2ce6a4bcca
commit 7419fde9a0
17 changed files with 266 additions and 192 deletions

View File

@@ -9,11 +9,14 @@
#include <ccan/short_types/short_types.h>
#include <stdlib.h>
struct channel_id {
struct short_channel_id {
u32 blocknum;
u32 txnum : 24;
u8 outnum : 8;
};
struct channel_id {
u8 id[32];
};
struct ipv6 {
u8 addr[16];
};
@@ -27,6 +30,8 @@ void towire_privkey(u8 **pptr, const struct privkey *privkey);
void towire_secp256k1_ecdsa_signature(u8 **pptr,
const secp256k1_ecdsa_signature *signature);
void towire_channel_id(u8 **pptr, const struct channel_id *channel_id);
void towire_short_channel_id(u8 **pptr,
const struct short_channel_id *short_channel_id);
void towire_sha256(u8 **pptr, const struct sha256 *sha256);
void towire_sha256_double(u8 **pptr, const struct sha256_double *sha256d);
void towire_ipv6(u8 **pptr, const struct ipv6 *ipv6);
@@ -59,6 +64,8 @@ void fromwire_secp256k1_ecdsa_signature(const u8 **cursor, size_t *max,
secp256k1_ecdsa_signature *signature);
void fromwire_channel_id(const u8 **cursor, size_t *max,
struct channel_id *channel_id);
void fromwire_short_channel_id(const u8 **cursor, size_t *max,
struct short_channel_id *short_channel_id);
void fromwire_sha256(const u8 **cursor, size_t *max, struct sha256 *sha256);
void fromwire_sha256_double(const u8 **cursor, size_t *max,
struct sha256_double *sha256d);