remove is_local variable from listpeerchannels cb

is_local, ie. "is this side of the channel ours?" is not needed since we
can determine that predicate by evaluating
`scidd->dir == node_id_idx(self, peer)`
This commit is contained in:
Lagrang3 2024-04-02 07:51:05 +01:00 committed by Rusty Russell
parent 22a70339de
commit bb31856b80
6 changed files with 6 additions and 17 deletions

View file

@ -16,7 +16,6 @@ void gossmod_add_localchan(struct gossmap_localmods *mods,
u32 fee_proportional,
u32 cltv_delta,
bool enabled,
bool is_local UNUSED,
const char *buf UNUSED,
const jsmntok_t *chantok UNUSED,
void *cbarg UNUSED)
@ -54,7 +53,6 @@ gossmods_from_listpeerchannels_(const tal_t *ctx,
u32 fee_proportional,
u32 cltv_delta,
bool enabled,
bool is_local,
const char *buf,
const jsmntok_t *chantok,
void *cbarg),
@ -152,7 +150,7 @@ gossmods_from_listpeerchannels_(const tal_t *ctx,
/* We add both directions */
cb(mods, self, &dst, &scidd, htlc_min[LOCAL], htlc_max[LOCAL],
spendable, fee_base[LOCAL], fee_proportional[LOCAL],
cltv_delta[LOCAL], enabled, true, buf, channel, cbarg);
cltv_delta[LOCAL], enabled, buf, channel, cbarg);
/* If we didn't have a remote update, it's not usable yet */
if (fee_proportional[REMOTE] == -1U)
@ -162,7 +160,7 @@ gossmods_from_listpeerchannels_(const tal_t *ctx,
cb(mods, self, &dst, &scidd, htlc_min[REMOTE], htlc_max[REMOTE],
receivable, fee_base[REMOTE], fee_proportional[REMOTE],
cltv_delta[REMOTE], enabled, false, buf, channel, cbarg);
cltv_delta[REMOTE], enabled, buf, channel, cbarg);
}
return mods;

View file

@ -37,7 +37,6 @@ struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx,
u32 fee_proportional,
u32 cltv_delta,
bool enabled,
bool is_local,
const char *buf_,
const jsmntok_t *chantok,
void *cbarg_),
@ -57,7 +56,6 @@ struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx,
u32, \
u32, \
bool, \
bool, \
const char *, \
const jsmntok_t *), \
(cbarg))
@ -74,7 +72,6 @@ void gossmod_add_localchan(struct gossmap_localmods *mods,
u32 fee_proportional,
u32 cltv_delta,
bool enabled,
bool is_local,
const char *buf UNUSED,
const jsmntok_t *chantok UNUSED,
void *cbarg UNUSED);

View file

@ -465,19 +465,18 @@ static void gossmod_cb(struct gossmap_localmods *mods,
u32 fee_proportional,
u32 cltv_delta,
bool enabled,
bool is_local,
const char *buf,
const jsmntok_t *chantok,
struct payment *payment)
{
struct amount_msat min, max;
if (is_local) {
/* local channels can send up to what's spendable */
if (scidd->dir == node_id_idx(self, peer)) {
/* our side of the channel can send up to what's spendable */
min = AMOUNT_MSAT(0);
max = spendable;
} else {
/* remote channels can send up no more than spendable */
/* the remote side can send up to no more than spendable */
min = htlcmin;
max = amount_msat_min(spendable, htlcmax);
}

View file

@ -49,7 +49,6 @@ void gossmod_add_localchan(struct gossmap_localmods *mods UNNEEDED,
u32 fee_proportional UNNEEDED,
u32 cltv_delta UNNEEDED,
bool enabled UNNEEDED,
bool is_local UNNEEDED,
const char *buf UNUSED UNNEEDED,
const jsmntok_t *chantok UNUSED UNNEEDED,
void *cbarg UNUSED UNNEEDED)
@ -71,7 +70,6 @@ struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx UNNEE
u32 fee_proportional UNNEEDED,
u32 cltv_delta UNNEEDED,
bool enabled UNNEEDED,
bool is_local UNNEEDED,
const char *buf_ UNNEEDED,
const jsmntok_t *chantok UNNEEDED,
void *cbarg_) UNNEEDED,

View file

@ -46,7 +46,6 @@ void gossmod_add_localchan(struct gossmap_localmods *mods UNNEEDED,
u32 fee_proportional UNNEEDED,
u32 cltv_delta UNNEEDED,
bool enabled UNNEEDED,
bool is_local UNNEEDED,
const char *buf UNUSED UNNEEDED,
const jsmntok_t *chantok UNUSED UNNEEDED,
void *cbarg UNUSED UNNEEDED)
@ -68,7 +67,6 @@ struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx UNNEE
u32 fee_proportional UNNEEDED,
u32 cltv_delta UNNEEDED,
bool enabled UNNEEDED,
bool is_local UNNEEDED,
const char *buf_ UNNEEDED,
const jsmntok_t *chantok UNNEEDED,
void *cbarg_) UNNEEDED,

View file

@ -369,7 +369,6 @@ static void gossmod_add_unknown_localchan(struct gossmap_localmods *mods,
u32 fee_proportional,
u32 cltv_delta,
bool enabled,
bool is_local,
const char *buf UNUSED,
const jsmntok_t *chantok UNUSED,
struct gossmap *gossmap)
@ -379,7 +378,7 @@ static void gossmod_add_unknown_localchan(struct gossmap_localmods *mods,
gossmod_add_localchan(mods, self, peer, scidd, min, max, spendable,
fee_base, fee_proportional, cltv_delta, enabled,
is_local, buf, chantok, gossmap);
buf, chantok, gossmap);
}
/* FIXME: We don't need this listpeerchannels at all if not deprecated! */