MCPcopy Create free account
hub / github.com/ElementsProject/lightning / unused_chans_for_node

Function unused_chans_for_node

common/splice_script.c:1505–1535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1503}
1504
1505static struct channel_id **unused_chans_for_node(const tal_t *ctx,
1506 struct splice_script_chan **channels,
1507 struct token **tokensA,
1508 size_t a_size,
1509 struct token **tokensB,
1510 size_t b_size,
1511 struct node_id node_id)
1512{
1513 struct channel_id **result = tal_arr(ctx, struct channel_id*, 0);
1514
1515 for (size_t i = 0; i < tal_count(channels); i++) {
1516 bool used = false;
1517 if (!node_id_eq(&node_id, &channels[i]->node_id))
1518 continue;
1519 for (size_t j = 0; j < a_size; j++)
1520 if (matches_chan_id(tokensA[j], channels[i]->chan_id))
1521 used = true;
1522 for (size_t k = 0; k < b_size; k++)
1523 if (matches_chan_id(tokensB[k], channels[i]->chan_id))
1524 used = true;
1525 if (!used)
1526 tal_arr_expand(&result, tal_dup(result,
1527 struct channel_id,
1528 &channels[i]->chan_id));
1529 }
1530
1531 if (!tal_count(result))
1532 result = tal_free(result);
1533
1534 return result;
1535}
1536
1537static bool parse_channel_index(struct token *token, size_t *channel_index)
1538{

Callers 1

resolve_channel_idsFunction · 0.85

Calls 3

node_id_eqFunction · 0.85
matches_chan_idFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected