renepay: remove always-true "first_time" and "unlikely_ok" flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-08-10 09:31:20 +09:30
parent 5e5f592369
commit 40d93c2af7
3 changed files with 5 additions and 25 deletions

View File

@@ -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,
@@ -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. */
@@ -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__);
@@ -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)),
@@ -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);
}

View File

@@ -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)
{
@@ -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,
@@ -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)
{

View File

@@ -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);