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

Function route_exclusions_step_cb

plugins/libplugin-pay.c:3913–3940  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3911}
3912
3913static struct command_result *route_exclusions_step_cb(struct route_exclusions_data *d,
3914 struct payment *p)
3915{
3916 if (p->parent)
3917 return payment_continue(p);
3918 struct route_exclusion **exclusions = d->exclusions;
3919 for (size_t i = 0; i < tal_count(exclusions); i++) {
3920 struct route_exclusion *e = exclusions[i];
3921
3922 /* We don't need the details if we skip anyway. */
3923 struct amount_msat total = AMOUNT_MSAT(0);
3924
3925 if (e->type == EXCLUDE_CHANNEL) {
3926 channel_hints_update(p, e->u.chan_id.scid,
3927 e->u.chan_id.dir, false, false,
3928 NULL, total, NULL);
3929 } else {
3930 if (node_id_eq(&e->u.node_id, p->route_destination)) {
3931 return payment_abort(p, PAY_USER_ERROR, "Payee is manually excluded");
3932 } else if (node_id_eq(&e->u.node_id, p->local_id)) {
3933 return payment_abort(p, PAY_USER_ERROR, "Payer is manually excluded");
3934 }
3935
3936 tal_arr_expand(&p->excluded_nodes, e->u.node_id);
3937 }
3938 }
3939 return payment_continue(p);
3940}
3941
3942REGISTER_PAYMENT_MODIFIER(route_exclusions, struct route_exclusions_data *,
3943 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