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
| 2915 | * `excludes` parameter of `getroute`. |
| 2916 | */ |
| 2917 | static |
| 2918 | struct 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. */ |
no outgoing calls
no test coverage detected