Skip to content

Commit

Permalink
renepay: remove always-true "first_time" and "unlikely_ok" flags.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Aug 12, 2023
1 parent 5e5f592 commit 40d93c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
15 changes: 4 additions & 11 deletions plugins/renepay/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ struct pay_plugin * const pay_plugin = &the_pay_plugin;

static void timer_kick(struct payment *payment);
static struct command_result *try_paying(struct command *cmd,
struct payment *payment,
bool first_time);
struct payment *payment);

void amount_msat_accumulate_(struct amount_msat *dst,
struct amount_msat src,
Expand Down Expand Up @@ -152,7 +151,7 @@ static void timer_kick(struct payment *payment)
case PAYMENT_FAIL:
plugin_log(pay_plugin->plugin,LOG_DBG,"status is PAYMENT_FAIL");
payment_assert_delivering_incomplete(payment);
try_paying(payment->cmd,payment,/* always try even if prob is low */ true);
try_paying(payment->cmd, payment);
break;

/* Nothing has returned yet, we have to wait. */
Expand Down Expand Up @@ -472,8 +471,7 @@ sendpay_flows(struct command *cmd,
}

static struct command_result *try_paying(struct command *cmd,
struct payment *payment,
bool first_time)
struct payment *payment)
{
plugin_log(pay_plugin->plugin,LOG_DBG,"calling %s",__PRETTY_FUNCTION__);

Expand Down Expand Up @@ -537,11 +535,6 @@ static struct command_result *try_paying(struct command *cmd,
struct pay_flow **pay_flows = get_payflows(
payment,
remaining, feebudget,

/* would you accept unlikely
* payments? */
true,

/* is entire payment? */
amount_msat_eq(payment->total_delivering, AMOUNT_MSAT(0)),

Expand Down Expand Up @@ -595,7 +588,7 @@ static struct command_result *listpeerchannels_done(
/* When we terminate cmd for any reason, clear it from payment so we don't do it again. */
tal_add_destructor2(cmd, destroy_cmd_payment_ptr, payment);

return try_paying(cmd, payment, true);
return try_paying(cmd, payment);
}


Expand Down
14 changes: 1 addition & 13 deletions plugins/renepay/pay_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ static bool disable_htlc_violations(struct payment *payment,
struct pay_flow **get_payflows(struct payment *p,
struct amount_msat amount,
struct amount_msat feebudget,
bool unlikely_ok,
bool is_entire_payment,
const char **err_msg)
{
Expand Down Expand Up @@ -365,7 +364,7 @@ struct pay_flow **get_payflows(struct payment *p,
double prob;
struct amount_msat fee;
u64 delay;
bool too_unlikely, too_expensive, too_delayed;
bool too_expensive, too_delayed;
const u32 *final_cltvs;

flows = minflow(tmpctx, pay_plugin->gossmap, src, dst,
Expand Down Expand Up @@ -399,17 +398,6 @@ struct pay_flow **get_payflows(struct payment *p,
type_to_string(tmpctx,struct amount_msat,&fee),
delay);

too_unlikely = (prob < p->min_prob_success);
if (too_unlikely && !unlikely_ok)
{
debug_paynote(p, "Flows too unlikely, P() = %f%%", prob * 100);
*err_msg = tal_fmt(tmpctx,
"Probability is too small, "
"Prob = %f%% (min = %f%%)",
prob*100,
p->min_prob_success*100);
goto fail;
}
too_expensive = amount_msat_greater(fee, feebudget);
if (too_expensive)
{
Expand Down
1 change: 0 additions & 1 deletion plugins/renepay/pay_flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ HTABLE_DEFINE_TYPE(struct pay_flow,
struct pay_flow **get_payflows(struct payment *payment,
struct amount_msat amount,
struct amount_msat feebudget,
bool unlikely_ok,
bool is_entire_payment,
const char **err_msg);

Expand Down

0 comments on commit 40d93c2

Please sign in to comment.