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

Function routehint_generate_exclusion_list

plugins/libplugin-pay.c:2647–2668  ·  view source on GitHub ↗

routehint_generate_exclusion_list * * @brief generate a list of items to append to `excludes` * parameter of `getroute`. * * @param ctx - the context to allocate off of. * @param routehint - the actual routehint, a `tal` array. * @param payment - the payment that we will create an * exclusion list for. * * @return an array of strings that will be appended to the * `excludes` parameter o

Source from the content-addressed store, hash-verified

2645 * `excludes` parameter of `getroute`.
2646 */
2647static
2648struct node_id *routehint_generate_exclusion_list(const tal_t *ctx,
2649 struct route_info *routehint,
2650 struct payment *payment)
2651{
2652 struct node_id *exc;
2653
2654 if (!routehint || tal_count(routehint) == 0)
2655 /* Nothing to exclude. */
2656 return NULL;
2657
2658 exc = tal_arr(ctx, struct node_id, tal_count(routehint));
2659 /* Exclude every node except the first, because the first is
2660 * the entry point to the routehint. */
2661 for (size_t i = 1 /* Skip the first! */; i < tal_count(routehint); ++i)
2662 exc[i-1] = routehint[i].pubkey;
2663
2664 /* Also exclude the destination, because it would be foolish to
2665 * pass through it and *then* go to the routehint entry point. */
2666 exc[tal_count(routehint)-1] = *payment->destination;
2667 return exc;
2668}
2669
2670/* Change the destination and compute the final msatoshi amount to send to the
2671 * routehint entry point. */

Callers 1

routehint_pre_getrouteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected