Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renepay refactors and cleanups #6538

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2e1d6c3
renepay: remove unused all_flows field.
rustyrussell Aug 9, 2023
8c0e4fe
renepay: remove attempt limit.
rustyrussell Aug 9, 2023
9fe203e
renepay: fix localmods.
rustyrussell Aug 9, 2023
70042fe
renepay: use more formal allocator pattern.
rustyrussell Aug 10, 2023
52260c6
renepay: move list_node to first member of struct payment.
rustyrussell Aug 10, 2023
dccf487
renepay: make memleak simpler.
rustyrussell Aug 10, 2023
698f415
renepay: merge `struct renepay` and `struct payment` into one.
rustyrussell Aug 10, 2023
fa90e58
renepay: get max group_id in single iteration.
rustyrussell Aug 10, 2023
2b813ac
renepay: simplify JSON handling.
rustyrussell Aug 10, 2023
775cebc
renepay: simplify JSON handling in notification_sendpay_success.
rustyrussell Aug 10, 2023
0fb46e1
renepay: don't re-parse bolt11 to get routehints.
rustyrussell Aug 10, 2023
e1da480
renepay: put the entire hash in the key struct.
rustyrussell Aug 10, 2023
149057f
renepay: remove unused result member.
rustyrussell Aug 10, 2023
99f331e
renepay: remove always-true "first_time" and "unlikely_ok" flags.
rustyrussell Aug 10, 2023
c358b56
renepay: fix up handling of errors from final node.
rustyrussell Aug 10, 2023
e4b386f
renepay: make pay_plugin a tal object.
rustyrussell Aug 10, 2023
8cdef9a
renepay: grab update from WIRE_TEMPORARY_CHANNEL_FAILURE if present.
rustyrussell Aug 10, 2023
a578732
renepay: drive *all* progress from termination of struct pay_flow.
rustyrussell Aug 10, 2023
d4ea3da
renepay: add dummy pf_resuly type to ensure we deal with the flow.
rustyrussell Aug 10, 2023
07d78c9
renepay: do less work in destroy_pay_flow, and reorder pay_flow.c
rustyrussell Aug 10, 2023
a64a6ba
renepay: trivial cleanup to rename `flow` to `pf` everywhere.
rustyrussell Aug 10, 2023
4f25609
renepay: add command notifications
rustyrussell Aug 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions plugins/renepay/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
rustyrussell marked this conversation as resolved.
Show resolved Hide resolved

// plugin_log(pay_plugin->plugin,LOG_DBG,"get_payflows produced %s",fmt_payflows(tmpctx,pay_flows));

Expand Down Expand Up @@ -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);
}

Expand Down
12 changes: 0 additions & 12 deletions plugins/renepay/payment.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion plugins/renepay/payment.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down