mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 11:59:16 +01:00
renepay: fix localmods.
You cannot refresh the gossmap with localmods applied, nor apply localmods when others have applied localmods in the same process. There are optimizations we could do, but for now always apply/unapply before querying gossmap. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0a9b3d6740
commit
ca72a230f3
3 changed files with 2 additions and 17 deletions
|
@ -546,6 +546,7 @@ static struct command_result *try_paying(struct command *cmd,
|
|||
|
||||
/* We let this return an unlikely path, as it's better to try once
|
||||
* than simply refuse. Plus, models are not truth! */
|
||||
gossmap_apply_localmods(pay_plugin->gossmap, renepay->local_gossmods);
|
||||
struct pay_flow **pay_flows = get_payflows(
|
||||
renepay,
|
||||
remaining, feebudget,
|
||||
|
@ -558,6 +559,7 @@ static struct command_result *try_paying(struct command *cmd,
|
|||
amount_msat_eq(p->total_delivering, AMOUNT_MSAT(0)),
|
||||
|
||||
&err_msg);
|
||||
gossmap_remove_localmods(pay_plugin->gossmap, renepay->local_gossmods);
|
||||
|
||||
// plugin_log(pay_plugin->plugin,LOG_DBG,"get_payflows produced %s",fmt_payflows(tmpctx,pay_flows));
|
||||
|
||||
|
@ -590,13 +592,9 @@ static struct command_result *listpeerchannels_done(
|
|||
"listpeerchannels malformed: %.*s",
|
||||
json_tok_full_len(result),
|
||||
json_tok_full(buf, result));
|
||||
// So we have all localmods data, now we apply it. Only once per
|
||||
// payment.
|
||||
// TODO(eduardo): check that there won't be a prob. cost associated with
|
||||
// any gossmap local chan. The same way there aren't fees to pay for my
|
||||
// local channels.
|
||||
gossmap_apply_localmods(pay_plugin->gossmap,renepay->local_gossmods);
|
||||
renepay->localmods_applied=true;
|
||||
return try_paying(cmd, renepay, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ struct renepay * renepay_new(struct command *cmd)
|
|||
|
||||
renepay->cmd = cmd;
|
||||
renepay->payment = payment_new(renepay);
|
||||
renepay->localmods_applied=false;
|
||||
renepay->local_gossmods = gossmap_localmods_new(renepay);
|
||||
renepay->disabled = tal_arr(renepay,struct short_channel_id,0);
|
||||
renepay->rexmit_timer = NULL;
|
||||
|
@ -190,21 +189,10 @@ void renepay_cleanup(
|
|||
struct gossmap * gossmap)
|
||||
{
|
||||
debug_info("calling %s",__PRETTY_FUNCTION__);
|
||||
/* Always remove our local mods (routehints) so others can use
|
||||
* gossmap. We do this only after the payment completes. */
|
||||
// TODO(eduardo): it can happen that local_gossmods removed below
|
||||
// contained a set of channels for which there is information in the
|
||||
// uncertainty network (chan_extra_map) and that are part of some pending
|
||||
// payflow (payflow_map). Handle this situation.
|
||||
if(renepay->localmods_applied)
|
||||
gossmap_remove_localmods(gossmap,
|
||||
renepay->local_gossmods);
|
||||
// TODO(eduardo): I wonder if it is possible to have two instances of
|
||||
// renepay at the same time.
|
||||
// 1st problem: dijkstra datastructure is global, this can be fixed,
|
||||
// 2nd problem: we don't know if gossmap_apply_localmods and gossmap_remove_localmods,
|
||||
// can handle different local_gossmods applied to the same gossmap.
|
||||
renepay->localmods_applied=false;
|
||||
tal_free(renepay->local_gossmods);
|
||||
|
||||
renepay->rexmit_timer = tal_free(renepay->rexmit_timer);
|
||||
|
|
|
@ -111,7 +111,6 @@ struct renepay
|
|||
struct payment * payment;
|
||||
|
||||
/* Localmods to apply to gossip_map for our own use. */
|
||||
bool localmods_applied;
|
||||
struct gossmap_localmods *local_gossmods;
|
||||
|
||||
/* Channels we decided to disable for various reasons. */
|
||||
|
|
Loading…
Add table
Reference in a new issue