mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
gossipd: set no_forward bit on channel_update for private channels.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: Protocol: We now set the `dont_forward` bit on private channel_update's message_flags (as per latest BOLTs).
This commit is contained in:
parent
bb49e1bea5
commit
bfc21cbb55
7 changed files with 30 additions and 17 deletions
|
@ -369,14 +369,16 @@ static void send_channel_update(struct peer *peer, int disable_flag)
|
|||
assert(peer->short_channel_ids[LOCAL].u64);
|
||||
|
||||
msg = towire_channeld_local_channel_update(NULL,
|
||||
&peer->short_channel_ids[LOCAL],
|
||||
disable_flag
|
||||
== ROUTING_FLAGS_DISABLED,
|
||||
peer->cltv_delta,
|
||||
peer->htlc_minimum_msat,
|
||||
peer->fee_base,
|
||||
peer->fee_per_satoshi,
|
||||
peer->htlc_maximum_msat);
|
||||
&peer->short_channel_ids[LOCAL],
|
||||
disable_flag
|
||||
== ROUTING_FLAGS_DISABLED,
|
||||
peer->cltv_delta,
|
||||
peer->htlc_minimum_msat,
|
||||
peer->fee_base,
|
||||
peer->fee_per_satoshi,
|
||||
peer->htlc_maximum_msat,
|
||||
peer->channel_flags
|
||||
& CHANNEL_FLAGS_ANNOUNCE_CHANNEL);
|
||||
wire_sync_write(MASTER_FD, take(msg));
|
||||
}
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ msgdata,channeld_local_channel_update,htlc_minimum_msat,amount_msat,
|
|||
msgdata,channeld_local_channel_update,fee_base_msat,u32,
|
||||
msgdata,channeld_local_channel_update,fee_proportional_millionths,u32,
|
||||
msgdata,channeld_local_channel_update,htlc_maximum_msat,amount_msat,
|
||||
msgdata,channeld_local_channel_update,public,bool,
|
||||
|
||||
# Channeld: tell gossipd about our channel_announcement
|
||||
msgtype,channeld_local_channel_announcement,1014
|
||||
|
|
Can't render this file because it has a wrong number of fields in line 14.
|
|
@ -513,7 +513,8 @@ static u8 *create_unsigned_update(const tal_t *ctx,
|
|||
struct amount_msat htlc_minimum,
|
||||
struct amount_msat htlc_maximum,
|
||||
u32 fee_base_msat,
|
||||
u32 fee_proportional_millionths)
|
||||
u32 fee_proportional_millionths,
|
||||
bool public)
|
||||
{
|
||||
secp256k1_ecdsa_signature dummy_sig;
|
||||
u8 message_flags, channel_flags;
|
||||
|
@ -548,6 +549,8 @@ static u8 *create_unsigned_update(const tal_t *ctx,
|
|||
* | 1 | `dont_forward` |
|
||||
*/
|
||||
message_flags = ROUTING_OPT_HTLC_MAX_MSAT;
|
||||
if (!public)
|
||||
message_flags |= ROUTING_OPT_DONT_FORWARD;
|
||||
|
||||
/* We create an update with a dummy signature and timestamp. */
|
||||
return towire_channel_update(ctx,
|
||||
|
@ -771,7 +774,8 @@ void refresh_local_channel(struct daemon *daemon,
|
|||
false, cltv_expiry_delta,
|
||||
htlc_minimum, htlc_maximum,
|
||||
fee_base_msat,
|
||||
fee_proportional_millionths);
|
||||
fee_proportional_millionths,
|
||||
!(message_flags & ROUTING_OPT_DONT_FORWARD));
|
||||
sign_timestamp_and_apply_update(daemon, chan, direction, take(update));
|
||||
}
|
||||
|
||||
|
@ -788,6 +792,7 @@ void handle_local_channel_update(struct daemon *daemon, const u8 *msg)
|
|||
int direction;
|
||||
u8 *unsigned_update;
|
||||
const struct half_chan *hc;
|
||||
bool public;
|
||||
|
||||
if (!fromwire_gossipd_local_channel_update(msg,
|
||||
&id,
|
||||
|
@ -797,7 +802,8 @@ void handle_local_channel_update(struct daemon *daemon, const u8 *msg)
|
|||
&htlc_minimum,
|
||||
&fee_base_msat,
|
||||
&fee_proportional_millionths,
|
||||
&htlc_maximum)) {
|
||||
&htlc_maximum,
|
||||
&public)) {
|
||||
master_badmsg(WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE, msg);
|
||||
}
|
||||
|
||||
|
@ -822,7 +828,8 @@ void handle_local_channel_update(struct daemon *daemon, const u8 *msg)
|
|||
disable, cltv_expiry_delta,
|
||||
htlc_minimum, htlc_maximum,
|
||||
fee_base_msat,
|
||||
fee_proportional_millionths);
|
||||
fee_proportional_millionths,
|
||||
public);
|
||||
|
||||
hc = &chan->half[direction];
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ msgdata,gossipd_local_channel_update,htlc_minimum_msat,amount_msat,
|
|||
msgdata,gossipd_local_channel_update,fee_base_msat,u32,
|
||||
msgdata,gossipd_local_channel_update,fee_proportional_millionths,u32,
|
||||
msgdata,gossipd_local_channel_update,htlc_maximum_msat,amount_msat,
|
||||
msgdata,gossipd_local_channel_update,public,bool,
|
||||
|
||||
# Send this channel_announcement
|
||||
msgtype,gossipd_local_channel_announcement,3006
|
||||
|
|
|
|
@ -34,7 +34,7 @@ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
|||
struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "find_peer called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_gossipd_local_channel_update */
|
||||
bool fromwire_gossipd_local_channel_update(const void *p UNNEEDED, struct node_id *id UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, bool *disable UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, struct amount_msat *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, struct amount_msat *htlc_maximum_msat UNNEEDED)
|
||||
bool fromwire_gossipd_local_channel_update(const void *p UNNEEDED, struct node_id *id UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, bool *disable UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, struct amount_msat *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, struct amount_msat *htlc_maximum_msat UNNEEDED, bool *public UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossipd_local_channel_update called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_gossipd_used_local_channel_update */
|
||||
bool fromwire_gossipd_used_local_channel_update(const void *p UNNEEDED, struct short_channel_id *scid UNNEEDED)
|
||||
|
|
|
@ -55,7 +55,7 @@ struct peer *find_peer(struct daemon *daemon UNNEEDED, const struct node_id *id
|
|||
bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossipd_dev_set_max_scids_encode_size called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_gossipd_local_channel_update */
|
||||
bool fromwire_gossipd_local_channel_update(const void *p UNNEEDED, struct node_id *id UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, bool *disable UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, struct amount_msat *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, struct amount_msat *htlc_maximum_msat UNNEEDED)
|
||||
bool fromwire_gossipd_local_channel_update(const void *p UNNEEDED, struct node_id *id UNNEEDED, struct short_channel_id *short_channel_id UNNEEDED, bool *disable UNNEEDED, u16 *cltv_expiry_delta UNNEEDED, struct amount_msat *htlc_minimum_msat UNNEEDED, u32 *fee_base_msat UNNEEDED, u32 *fee_proportional_millionths UNNEEDED, struct amount_msat *htlc_maximum_msat UNNEEDED, bool *public UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossipd_local_channel_update called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_gossipd_used_local_channel_update */
|
||||
bool fromwire_gossipd_used_local_channel_update(const void *p UNNEEDED, struct short_channel_id *scid UNNEEDED)
|
||||
|
|
|
@ -286,7 +286,7 @@ void tell_gossipd_local_channel_update(struct lightningd *ld,
|
|||
const u8 *msg)
|
||||
{
|
||||
struct short_channel_id scid;
|
||||
bool disable;
|
||||
bool disable, public;
|
||||
u16 cltv_expiry_delta;
|
||||
struct amount_msat htlc_minimum_msat;
|
||||
u32 fee_base_msat, fee_proportional_millionths;
|
||||
|
@ -297,7 +297,7 @@ void tell_gossipd_local_channel_update(struct lightningd *ld,
|
|||
&htlc_minimum_msat,
|
||||
&fee_base_msat,
|
||||
&fee_proportional_millionths,
|
||||
&htlc_maximum_msat)) {
|
||||
&htlc_maximum_msat, &public)) {
|
||||
channel_internal_error(channel,
|
||||
"bad channeld_local_channel_update %s",
|
||||
tal_hex(channel, msg));
|
||||
|
@ -317,7 +317,9 @@ void tell_gossipd_local_channel_update(struct lightningd *ld,
|
|||
cltv_expiry_delta,
|
||||
htlc_minimum_msat,
|
||||
fee_base_msat,
|
||||
fee_proportional_millionths, htlc_maximum_msat)));
|
||||
fee_proportional_millionths,
|
||||
htlc_maximum_msat,
|
||||
public)));
|
||||
}
|
||||
|
||||
void tell_gossipd_local_channel_announce(struct lightningd *ld,
|
||||
|
|
Loading…
Add table
Reference in a new issue