mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
handle_disable_channel: don't use get_connection_by_scid.
This removes the final user, so we remove it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
74ee448bda
commit
00194b6130
@ -1810,6 +1810,7 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn,
|
||||
tal_t *tmpctx = tal_tmpctx(msg);
|
||||
struct short_channel_id scid;
|
||||
u8 direction;
|
||||
struct routing_channel *chan;
|
||||
struct node_connection *nc;
|
||||
bool active;
|
||||
u16 flags, cltv_expiry_delta;
|
||||
@ -1824,15 +1825,15 @@ static struct io_plan *handle_disable_channel(struct io_conn *conn,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
nc = get_connection_by_scid(daemon->rstate, &scid, direction);
|
||||
|
||||
if (!nc) {
|
||||
chan = get_channel(daemon->rstate, &scid);
|
||||
if (!chan || !chan->connections[direction]) {
|
||||
status_trace(
|
||||
"Unable to find channel %s/%d",
|
||||
type_to_string(msg, struct short_channel_id, &scid),
|
||||
direction);
|
||||
goto fail;
|
||||
}
|
||||
nc = chan->connections[direction];
|
||||
|
||||
status_trace("Disabling channel %s/%d, active %d -> %d",
|
||||
type_to_string(msg, struct short_channel_id, &scid),
|
||||
|
@ -196,19 +196,6 @@ static void destroy_routing_channel(struct routing_channel *chan,
|
||||
tal_free(chan->nodes[1]);
|
||||
}
|
||||
|
||||
/* FIXME: All users of this are confused. */
|
||||
struct node_connection *get_connection_by_scid(const struct routing_state *rstate,
|
||||
const struct short_channel_id *scid,
|
||||
const u8 direction)
|
||||
{
|
||||
struct routing_channel *chan = get_channel(rstate, scid);
|
||||
|
||||
if (chan == NULL)
|
||||
return NULL;
|
||||
else
|
||||
return chan->connections[direction];
|
||||
}
|
||||
|
||||
static void destroy_node_connection(struct node_connection *nc,
|
||||
struct routing_channel *chan)
|
||||
{
|
||||
|
@ -188,12 +188,6 @@ struct routing_channel *new_routing_channel(struct routing_state *rstate,
|
||||
const struct pubkey *id1,
|
||||
const struct pubkey *id2);
|
||||
|
||||
/* Given a short_channel_id, retrieve the matching connection, or NULL if it is
|
||||
* unknown. */
|
||||
struct node_connection *get_connection_by_scid(const struct routing_state *rstate,
|
||||
const struct short_channel_id *schanid,
|
||||
const u8 direction);
|
||||
|
||||
/* Handlers for incoming messages */
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user