From 89663454c89f9b46c12d681951860a6604c447a3 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Fri, 2 Feb 2018 01:06:26 +0000 Subject: [PATCH] routing: Factor out function to determine if we can route through a channel. --- gossipd/routing.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index 4b2251753..8ad62c8cf 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -341,6 +341,12 @@ static void bfg_one_edge(struct node *node, size_t edgenum, double riskfactor) } } +/* Determine if the given node_connection is routable */ +static bool nc_is_routable(const struct node_connection *nc) +{ + return nc->active; +} + /* riskfactor is already scaled to per-block amount */ static struct node_connection * find_route(const tal_t *ctx, struct routing_state *rstate, @@ -397,8 +403,8 @@ find_route(const tal_t *ctx, struct routing_state *rstate, type_to_string(trc, struct pubkey, &n->id), i, num_edges); - if (!n->in[i]->active) { - SUPERVERBOSE("...inactive"); + if (!nc_is_routable(n->in[i])) { + SUPERVERBOSE("...unroutable"); continue; } bfg_one_edge(n, i, riskfactor);