| 3437 | } |
| 3438 | |
| 3439 | static struct command_result *shadow_route_cb(struct shadow_route_data *d, |
| 3440 | struct payment *p) |
| 3441 | { |
| 3442 | if (!d->use_shadow) |
| 3443 | return payment_continue(p); |
| 3444 | |
| 3445 | if (p->step != PAYMENT_STEP_INITIALIZED) |
| 3446 | return payment_continue(p); |
| 3447 | |
| 3448 | d->destination = *p->route_destination; |
| 3449 | |
| 3450 | /* Allow shadowroutes to consume up to 1/4th of our budget. */ |
| 3451 | d->constraints.cltv_budget = p->constraints.cltv_budget / 4; |
| 3452 | d->constraints.fee_budget |
| 3453 | = amount_msat_div(p->constraints.fee_budget, 4); |
| 3454 | |
| 3455 | if (pseudorand(2) == 0) { |
| 3456 | return payment_continue(p); |
| 3457 | } else { |
| 3458 | return shadow_route_extend(d, p); |
| 3459 | } |
| 3460 | } |
| 3461 | |
| 3462 | REGISTER_PAYMENT_MODIFIER(shadowroute, struct shadow_route_data *, |
| 3463 | shadow_route_init, shadow_route_cb); |
nothing calls this directly
no test coverage detected