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

Function route_exclusions_step_cb

plugins/libplugin-pay.c:3897–3924  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3895}
3896
3897static struct command_result *route_exclusions_step_cb(struct route_exclusions_data *d,
3898 struct payment *p)
3899{
3900 if (p->parent)
3901 return payment_continue(p);
3902 struct route_exclusion **exclusions = d->exclusions;
3903 for (size_t i = 0; i < tal_count(exclusions); i++) {
3904 struct route_exclusion *e = exclusions[i];
3905
3906 /* We don't need the details if we skip anyway. */
3907 struct amount_msat total = AMOUNT_MSAT(0);
3908
3909 if (e->type == EXCLUDE_CHANNEL) {
3910 channel_hints_update(p, e->u.chan_id.scid,
3911 e->u.chan_id.dir, false, false,
3912 NULL, total, NULL);
3913 } else {
3914 if (node_id_eq(&e->u.node_id, p->route_destination)) {
3915 return payment_abort(p, PAY_USER_ERROR, "Payee is manually excluded");
3916 } else if (node_id_eq(&e->u.node_id, p->local_id)) {
3917 return payment_abort(p, PAY_USER_ERROR, "Payer is manually excluded");
3918 }
3919
3920 tal_arr_expand(&p->excluded_nodes, e->u.node_id);
3921 }
3922 }
3923 return payment_continue(p);
3924}
3925
3926REGISTER_PAYMENT_MODIFIER(route_exclusions, struct route_exclusions_data *,
3927 route_exclusions_data_init, route_exclusions_step_cb);

Callers

nothing calls this directly

Calls 4

channel_hints_updateFunction · 0.85
node_id_eqFunction · 0.85
payment_abortFunction · 0.85
payment_continueFunction · 0.70

Tested by

no test coverage detected