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

Function routehint_generate_exclusion_list

plugins/libplugin-pay.c:2917–2938  ·  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

2915 * `excludes` parameter of `getroute`.
2916 */
2917static
2918struct node_id *routehint_generate_exclusion_list(const tal_t *ctx,
2919 struct route_info *routehint,
2920 struct payment *payment)
2921{
2922 struct node_id *exc;
2923
2924 if (!routehint || tal_count(routehint) == 0)
2925 /* Nothing to exclude. */
2926 return NULL;
2927
2928 exc = tal_arr(ctx, struct node_id, tal_count(routehint));
2929 /* Exclude every node except the first, because the first is
2930 * the entry point to the routehint. */
2931 for (size_t i = 1 /* Skip the first! */; i < tal_count(routehint); ++i)
2932 exc[i-1] = routehint[i].pubkey;
2933
2934 /* Also exclude the destination, because it would be foolish to
2935 * pass through it and *then* go to the routehint entry point. */
2936 exc[tal_count(routehint)-1] = *payment->route_destination;
2937 return exc;
2938}
2939
2940/* Change the destination and compute the final msatoshi amount to send to the
2941 * routehint entry point. */

Callers 1

routehint_pre_getrouteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected