renepay: remove attempt limit.

Time is what users care about, so remove this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2023-08-09 11:45:58 +09:30
parent b5273610b2
commit 0a9b3d6740
5 changed files with 1 additions and 37 deletions

View file

@ -490,19 +490,9 @@ static struct command_result *try_paying(struct command *cmd,
struct payment * const p = renepay->payment;
plugin_log(pay_plugin->plugin,LOG_DBG,"calling %s",__PRETTY_FUNCTION__);
// TODO(eduardo): does it make sense to have this limit on attempts?
/* I am classifying the flows in attempt cycles. */
renepay_new_attempt(renepay);
/* We try only MAX_NUM_ATTEMPTS, then we give up. */
if ( renepay_attempt_count(renepay) > MAX_NUM_ATTEMPTS)
{
return renepay_fail(renepay, PAY_STOPPED_RETRYING,
"Reached maximum number of attempts (%d)",
MAX_NUM_ATTEMPTS);
}
struct amount_msat feebudget, fees_spent, remaining;
renepay->payment->status=PAYMENT_PENDING;
if (time_after(time_now(), p->stop_time))
return renepay_fail(renepay, PAY_STOPPED_RETRYING, "Timed out");

View file

@ -244,7 +244,6 @@ static struct pay_flow **flows_to_pay_flows(struct payment *payment,
pf->amounts = tal_steal(pf, f->amounts);
pf->path_dirs = tal_steal(pf, f->dirs);
pf->success_prob = f->success_prob;
pf->attempt = renepay_current_attempt(payment->renepay);
}
tal_free(flows);

View file

@ -14,9 +14,6 @@ struct pay_flow {
/* So we can be an independent object for callbacks. */
struct payment * payment;
// TODO(eduardo): remove this, unnecessary
int attempt;
/* Information to link this flow to a unique sendpay. */
struct payflow_key
{

View file

@ -53,7 +53,6 @@ struct renepay * renepay_new(struct command *cmd)
renepay->local_gossmods = gossmap_localmods_new(renepay);
renepay->disabled = tal_arr(renepay,struct short_channel_id,0);
renepay->rexmit_timer = NULL;
renepay->next_attempt=1;
renepay->next_partid=1;
return renepay;
@ -131,20 +130,6 @@ void payment_assert_delivering_all(const struct payment *p)
}
}
int renepay_current_attempt(const struct renepay * renepay)
{
return renepay->next_attempt-1;
}
int renepay_attempt_count(const struct renepay * renepay)
{
return renepay->next_attempt-1;
}
void renepay_new_attempt(struct renepay * renepay)
{
renepay->payment->status=PAYMENT_PENDING;
renepay->next_attempt++;
}
struct command_result *renepay_success(struct renepay * renepay)
{
debug_info("calling %s",__PRETTY_FUNCTION__);

View file

@ -120,8 +120,6 @@ struct renepay
/* Timers. */
struct plugin_timer *rexmit_timer;
/* Keep track of the number of attempts. */
int next_attempt;
/* Used in get_payflows to set ids to each pay_flow. */
u64 next_partid;
};
@ -143,11 +141,6 @@ void payment_note(struct payment *p, const char *fmt, ...);
void payment_assert_delivering_incomplete(const struct payment *p);
void payment_assert_delivering_all(const struct payment *p);
int renepay_current_attempt(const struct renepay *renepay);
int renepay_attempt_count(const struct renepay *renepay);
void renepay_new_attempt(struct renepay *renepay);
struct command_result *renepay_success(struct renepay *renepay);
struct command_result *renepay_fail(