|
|
@ -820,8 +820,6 @@ static struct command_result *add_shadow_route(struct command *cmd, |
|
|
|
const jsmntok_t *chan, *best = NULL; |
|
|
|
size_t i; |
|
|
|
u64 sample = 0; |
|
|
|
/* FIXME: Use route_info's cltv_expiry_delta member instead */ |
|
|
|
u32 cltv_fuzz; |
|
|
|
struct route_info *route = tal_arr(NULL, struct route_info, 1); |
|
|
|
|
|
|
|
json_for_each_arr(i, chan, channels) { |
|
|
@ -835,9 +833,9 @@ static struct command_result *add_shadow_route(struct command *cmd, |
|
|
|
continue; |
|
|
|
|
|
|
|
/* Don't use if total would exceed 1/4 of our time allowance. */ |
|
|
|
json_to_number(buf, json_get_member(buf, chan, "delay"), |
|
|
|
&cltv_fuzz); |
|
|
|
if ((pc->final_cltv + cltv_fuzz) * 4 > pc->maxdelay) |
|
|
|
json_to_u16(buf, json_get_member(buf, chan, "delay"), |
|
|
|
&route[0].cltv_expiry_delta); |
|
|
|
if ((pc->final_cltv + route[0].cltv_expiry_delta) * 4 > pc->maxdelay) |
|
|
|
continue; |
|
|
|
|
|
|
|
json_to_number(buf, json_get_member(buf, chan, "base_fee_millisatoshi"), |
|
|
@ -857,14 +855,14 @@ static struct command_result *add_shadow_route(struct command *cmd, |
|
|
|
return start_pay_attempt(cmd, pc, "Initial attempt"); |
|
|
|
} |
|
|
|
|
|
|
|
pc->final_cltv += cltv_fuzz; |
|
|
|
pc->final_cltv += route[0].cltv_expiry_delta; |
|
|
|
pc->shadow_dest = json_strdup(pc, buf, |
|
|
|
json_get_member(buf, best, "destination")); |
|
|
|
route_msatoshi(&pc->msat, pc->msat, route, 1); |
|
|
|
tal_append_fmt(&pc->ps->shadow, |
|
|
|
"Added %u cltv delay, %u base fee, and %u ppm fee " |
|
|
|
"for shadow to %s.", |
|
|
|
cltv_fuzz, route[0].fee_base_msat, |
|
|
|
route[0].cltv_expiry_delta, route[0].fee_base_msat, |
|
|
|
route[0].fee_proportional_millionths, |
|
|
|
pc->shadow_dest); |
|
|
|
tal_free(route); |
|
|
|