opening: update to new open_channel with channel_flags.

While we're there, make the announcement conditional on it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2017-06-27 12:25:01 +09:30
committed by Christian Decker
parent d492f3872c
commit de5bf56ffa
7 changed files with 50 additions and 8 deletions

View File

@@ -31,6 +31,7 @@ open_channel,153,revocation_basepoint,33
open_channel,186,payment_basepoint,33
open_channel,219,delayed_payment_basepoint,33
open_channel,252,first_per_commitment_point,33
open_channel,285,channel_flags,1
accept_channel,33
accept_channel,0,temporary_channel_id,32
accept_channel,32,dust_limit_satoshis,8

View File

@@ -19,6 +19,15 @@ bool is_unknown_msg_discardable(const u8 *cursor);
/* Return true if it's a gossip message. */
bool is_gossip_msg(const u8 *cursor);
/* BOLT #2:
*
* Only the least-significant bit of `channel_flags` is currently
* defined: `announce_channel`. This indicates whether the initiator
* of the funding flow wishes to advertise this channel publicly to
* the network as detailed within [BOLT #7]
*/
#define CHANNEL_FLAGS_ANNOUNCE_CHANNEL 1
/* Compare two short_channel_ids and return true if they are the equal */
bool short_channel_id_eq(const struct short_channel_id *a,
const struct short_channel_id *b);

View File

@@ -180,6 +180,7 @@ struct msg_open_channel {
struct pubkey payment_basepoint;
struct pubkey delayed_payment_basepoint;
struct pubkey first_per_commitment_point;
u8 channel_flags;
};
struct msg_update_fail_htlc {
struct channel_id channel_id;
@@ -268,7 +269,8 @@ static void *towire_struct_open_channel(const tal_t *ctx,
&s->revocation_basepoint,
&s->payment_basepoint,
&s->delayed_payment_basepoint,
&s->first_per_commitment_point);
&s->first_per_commitment_point,
s->channel_flags);
}
static struct msg_open_channel *fromwire_struct_open_channel(const tal_t *ctx, const void *p, size_t *plen)
@@ -291,7 +293,8 @@ static struct msg_open_channel *fromwire_struct_open_channel(const tal_t *ctx, c
&s->revocation_basepoint,
&s->payment_basepoint,
&s->delayed_payment_basepoint,
&s->first_per_commitment_point))
&s->first_per_commitment_point,
&s->channel_flags))
return s;
return tal_free(s);
}
@@ -788,7 +791,7 @@ static bool open_channel_eq(const struct msg_open_channel *a,
const struct msg_open_channel *b)
{
return eq_with(a, b, max_accepted_htlcs)
&& eq_between(a, b, funding_pubkey, first_per_commitment_point);
&& eq_between(a, b, funding_pubkey, channel_flags);
}
static bool channel_update_eq(const struct msg_channel_update *a,