| 3453 | } |
| 3454 | |
| 3455 | static struct command_result *shadow_route_cb(struct shadow_route_data *d, |
| 3456 | struct payment *p) |
| 3457 | { |
| 3458 | if (!d->use_shadow) |
| 3459 | return payment_continue(p); |
| 3460 | |
| 3461 | if (p->step != PAYMENT_STEP_INITIALIZED) |
| 3462 | return payment_continue(p); |
| 3463 | |
| 3464 | d->destination = *p->route_destination; |
| 3465 | |
| 3466 | /* Allow shadowroutes to consume up to 1/4th of our budget. */ |
| 3467 | d->constraints.cltv_budget = p->constraints.cltv_budget / 4; |
| 3468 | d->constraints.fee_budget |
| 3469 | = amount_msat_div(p->constraints.fee_budget, 4); |
| 3470 | |
| 3471 | if (pseudorand(2) == 0) { |
| 3472 | return payment_continue(p); |
| 3473 | } else { |
| 3474 | return shadow_route_extend(d, p); |
| 3475 | } |
| 3476 | } |
| 3477 | |
| 3478 | REGISTER_PAYMENT_MODIFIER(shadowroute, struct shadow_route_data *, |
| 3479 | shadow_route_init, shadow_route_cb); |
nothing calls this directly
no test coverage detected