gossipd: don't charge ourselves fees when calculating route.

This means there's now a semantic difference between the default `fromid`
and setting `fromid` explicitly to our own node_id.  In the default case,
it means we don't charge ourselves fees on the route.

This means we can spend the full channel balance.

We still want to consider the pricing of local channels, however:
there's a *reason* to discount one over another, and that is to bias
things.  So we add the first-hop fee to the *risk* value instead.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-05-31 17:00:33 +09:30
parent ad24d94c7b
commit ab31f40aa2
4 changed files with 58 additions and 23 deletions

View File

@@ -307,7 +307,7 @@ static struct command_result *json_getroute(struct command *cmd,
p_req("msatoshi", param_msat, &msat),
p_req("riskfactor", param_double, &riskfactor),
p_opt_def("cltv", param_number, &cltv, 9),
p_opt_def("fromid", param_node_id, &source, ld->id),
p_opt("fromid", param_node_id, &source),
p_opt_def("fuzzpercent", param_percent, &fuzz, 5.0),
p_opt("exclude", param_array, &excludetok),
p_opt_def("maxhops", param_number, &max_hops,