channeld/gossipd/lightningd: reverse polarity of channel_update 'disable_flag'
Rename it to `enable` and invert it everywhere. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -412,14 +412,10 @@ static void set_channel_type(struct channel *channel, const u8 *type)
|
||||
/* Tell gossipd to create channel_update (then it goes into
|
||||
* gossip_store, then streams out to peers, or sends it directly if
|
||||
* it's a private channel) */
|
||||
static void send_channel_update(struct peer *peer, int disable_flag)
|
||||
static void send_channel_update(struct peer *peer, bool enable)
|
||||
{
|
||||
status_debug("send_channel_update %d", disable_flag);
|
||||
|
||||
u8 *msg;
|
||||
|
||||
assert(disable_flag == 0 || disable_flag == ROUTING_FLAGS_DISABLED);
|
||||
|
||||
/* Only send an update if we told gossipd */
|
||||
if (!peer->channel_local_active)
|
||||
return;
|
||||
@@ -428,8 +424,7 @@ static void send_channel_update(struct peer *peer, int disable_flag)
|
||||
|
||||
msg = towire_channeld_local_channel_update(NULL,
|
||||
&peer->short_channel_ids[LOCAL],
|
||||
disable_flag
|
||||
== ROUTING_FLAGS_DISABLED,
|
||||
enable,
|
||||
peer->cltv_delta,
|
||||
peer->htlc_minimum_msat,
|
||||
peer->fee_base,
|
||||
@@ -448,7 +443,7 @@ static void send_channel_initial_update(struct peer *peer)
|
||||
* after creation. These mutations (ie. splice) must announce the
|
||||
* channel when they finish anyway, so it is safe to skip it here */
|
||||
if (!is_stfu_active(peer) && !peer->want_stfu)
|
||||
send_channel_update(peer, 0);
|
||||
send_channel_update(peer, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -593,7 +588,7 @@ static void announce_channel(struct peer *peer)
|
||||
wire_sync_write(MASTER_FD,
|
||||
take(towire_channeld_local_channel_announcement(NULL,
|
||||
cannounce)));
|
||||
send_channel_update(peer, 0);
|
||||
send_channel_update(peer, true);
|
||||
}
|
||||
|
||||
static void announce_channel_if_not_stfu(struct peer *peer)
|
||||
@@ -762,7 +757,7 @@ static void check_mutual_splice_locked(struct peer *peer)
|
||||
|
||||
channel_announcement_negotiate(peer);
|
||||
billboard_update(peer);
|
||||
send_channel_update(peer, 0);
|
||||
send_channel_update(peer, true);
|
||||
|
||||
peer->splice_state->inflights = tal_free(peer->splice_state->inflights);
|
||||
peer->splice_state->count = 0;
|
||||
@@ -1191,7 +1186,7 @@ static void maybe_send_shutdown(struct peer *peer)
|
||||
|
||||
/* Send a disable channel_update so others don't try to route
|
||||
* over us */
|
||||
send_channel_update(peer, ROUTING_FLAGS_DISABLED);
|
||||
send_channel_update(peer, false);
|
||||
|
||||
if (peer->shutdown_wrong_funding) {
|
||||
tlvs = tlv_shutdown_tlvs_new(tmpctx);
|
||||
@@ -2506,7 +2501,7 @@ static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown)
|
||||
* completed in the spec */
|
||||
|
||||
/* Disable the channel. */
|
||||
send_channel_update(peer, ROUTING_FLAGS_DISABLED);
|
||||
send_channel_update(peer, false);
|
||||
|
||||
if (!fromwire_shutdown(tmpctx, shutdown, &channel_id, &scriptpubkey,
|
||||
&tlvs))
|
||||
@@ -3454,7 +3449,7 @@ static void resume_splice_negotiation(struct peer *peer,
|
||||
chan_output_index);
|
||||
wire_sync_write(MASTER_FD, take(msg));
|
||||
|
||||
send_channel_update(peer, 0);
|
||||
send_channel_update(peer, true);
|
||||
}
|
||||
|
||||
static struct inflight *inflights_new(struct peer *peer)
|
||||
@@ -5510,7 +5505,7 @@ static void handle_config_channel(struct peer *peer, const u8 *inmsg)
|
||||
}
|
||||
|
||||
if (changed)
|
||||
send_channel_update(peer, 0);
|
||||
send_channel_update(peer, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -332,7 +332,7 @@ msgtype,channeld_send_error_reply,1108
|
||||
# Channeld: tell gossipd to make this channel_update.
|
||||
msgtype,channeld_local_channel_update,1013
|
||||
msgdata,channeld_local_channel_update,short_channel_id,short_channel_id,
|
||||
msgdata,channeld_local_channel_update,disable,bool,
|
||||
msgdata,channeld_local_channel_update,enable,bool,
|
||||
msgdata,channeld_local_channel_update,cltv_expiry_delta,u16,
|
||||
msgdata,channeld_local_channel_update,htlc_minimum_msat,amount_msat,
|
||||
msgdata,channeld_local_channel_update,fee_base_msat,u32,
|
||||
|
||||
|
@@ -520,7 +520,7 @@ static u8 *sign_and_timestamp_update(const tal_t *ctx,
|
||||
static u8 *create_unsigned_update(const tal_t *ctx,
|
||||
const struct short_channel_id *scid,
|
||||
int direction,
|
||||
bool disable,
|
||||
bool enable,
|
||||
u16 cltv_expiry_delta,
|
||||
struct amount_msat htlc_minimum,
|
||||
struct amount_msat htlc_maximum,
|
||||
@@ -547,7 +547,7 @@ static u8 *create_unsigned_update(const tal_t *ctx,
|
||||
* | 1 | `disable` | Disable the channel. |
|
||||
*/
|
||||
channel_flags = direction;
|
||||
if (disable)
|
||||
if (!enable)
|
||||
channel_flags |= ROUTING_FLAGS_DISABLED;
|
||||
|
||||
/* BOLT #7:
|
||||
@@ -796,7 +796,7 @@ void handle_local_channel_update(struct daemon *daemon, const u8 *msg)
|
||||
{
|
||||
struct node_id id;
|
||||
struct short_channel_id scid;
|
||||
bool disable;
|
||||
bool enable;
|
||||
u16 cltv_expiry_delta;
|
||||
struct amount_msat htlc_minimum, htlc_maximum;
|
||||
u32 fee_base_msat, fee_proportional_millionths;
|
||||
@@ -809,7 +809,7 @@ void handle_local_channel_update(struct daemon *daemon, const u8 *msg)
|
||||
if (!fromwire_gossipd_local_channel_update(msg,
|
||||
&id,
|
||||
&scid,
|
||||
&disable,
|
||||
&enable,
|
||||
&cltv_expiry_delta,
|
||||
&htlc_minimum,
|
||||
&fee_base_msat,
|
||||
@@ -837,7 +837,7 @@ void handle_local_channel_update(struct daemon *daemon, const u8 *msg)
|
||||
}
|
||||
|
||||
unsigned_update = create_unsigned_update(tmpctx, &scid, direction,
|
||||
disable, cltv_expiry_delta,
|
||||
enable, cltv_expiry_delta,
|
||||
htlc_minimum, htlc_maximum,
|
||||
fee_base_msat,
|
||||
fee_proportional_millionths,
|
||||
|
||||
@@ -106,7 +106,7 @@ msgdata,gossipd_got_local_channel_update,channel_update,u8,len
|
||||
msgtype,gossipd_local_channel_update,3004
|
||||
msgdata,gossipd_local_channel_update,id,node_id,
|
||||
msgdata,gossipd_local_channel_update,short_channel_id,short_channel_id,
|
||||
msgdata,gossipd_local_channel_update,disable,bool,
|
||||
msgdata,gossipd_local_channel_update,enable,bool,
|
||||
msgdata,gossipd_local_channel_update,cltv_expiry_delta,u16,
|
||||
msgdata,gossipd_local_channel_update,htlc_minimum_msat,amount_msat,
|
||||
msgdata,gossipd_local_channel_update,fee_base_msat,u32,
|
||||
|
||||
|
@@ -321,13 +321,13 @@ void tell_gossipd_local_channel_update(struct lightningd *ld,
|
||||
const u8 *msg)
|
||||
{
|
||||
struct short_channel_id scid;
|
||||
bool disable, public;
|
||||
bool enable, public;
|
||||
u16 cltv_expiry_delta;
|
||||
struct amount_msat htlc_minimum_msat;
|
||||
u32 fee_base_msat, fee_proportional_millionths;
|
||||
struct amount_msat htlc_maximum_msat;
|
||||
|
||||
if (!fromwire_channeld_local_channel_update(msg, &scid, &disable,
|
||||
if (!fromwire_channeld_local_channel_update(msg, &scid, &enable,
|
||||
&cltv_expiry_delta,
|
||||
&htlc_minimum_msat,
|
||||
&fee_base_msat,
|
||||
@@ -355,7 +355,7 @@ void tell_gossipd_local_channel_update(struct lightningd *ld,
|
||||
(NULL,
|
||||
&channel->peer->id,
|
||||
channel->scid ? channel->scid : channel->alias[LOCAL],
|
||||
disable,
|
||||
enable,
|
||||
ld->config.cltv_expiry_delta,
|
||||
channel->htlc_minimum_msat,
|
||||
channel->feerate_base,
|
||||
|
||||
Reference in New Issue
Block a user