mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-04 03:03:51 +01:00
renepay: remove remaining calls to debug_paynote in favor of payflow_note().
Some are redundant, others simply convert. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
574716dfd5
commit
32f5ae8d1f
4 changed files with 26 additions and 42 deletions
|
@ -30,9 +30,6 @@ void _debug_exec_branch(const char* fname,const char* fun, int lineno);
|
||||||
#define debug_err(...) \
|
#define debug_err(...) \
|
||||||
{_debug_info(MYLOG,__VA_ARGS__); abort();}
|
{_debug_info(MYLOG,__VA_ARGS__); abort();}
|
||||||
|
|
||||||
#define debug_paynote(p,...) \
|
|
||||||
{payment_note(p,LOG_INFORM,__VA_ARGS__);_debug_info(MYLOG,__VA_ARGS__);}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Debugging information goes either to payment notes or to lightningd log. */
|
/* Debugging information goes either to payment notes or to lightningd log. */
|
||||||
|
|
||||||
|
@ -42,9 +39,6 @@ void _debug_exec_branch(const char* fname,const char* fun, int lineno);
|
||||||
#define debug_err(...) \
|
#define debug_err(...) \
|
||||||
plugin_err(pay_plugin->plugin,__VA_ARGS__)
|
plugin_err(pay_plugin->plugin,__VA_ARGS__)
|
||||||
|
|
||||||
#define debug_paynote(p,...) \
|
|
||||||
payment_note(p,LOG_INFORM,__VA_ARGS__);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define debug_assert(expr) \
|
#define debug_assert(expr) \
|
||||||
|
|
|
@ -1046,25 +1046,18 @@ static struct pf_result *handle_sendpay_failure_payment(struct pay_flow *pf STEA
|
||||||
const u8 *raw)
|
const u8 *raw)
|
||||||
{
|
{
|
||||||
struct short_channel_id errscid;
|
struct short_channel_id errscid;
|
||||||
struct payment *p = pf->payment;
|
|
||||||
const u8 *update;
|
const u8 *update;
|
||||||
|
|
||||||
debug_assert(pf);
|
debug_assert(pf);
|
||||||
debug_assert(p);
|
|
||||||
|
|
||||||
/* Final node is usually a hard failure */
|
/* Final node is usually a hard failure */
|
||||||
if (erridx == tal_count(pf->path_scidds)) {
|
if (erridx == tal_count(pf->path_scidds)) {
|
||||||
debug_paynote(p,
|
|
||||||
"onion error %s from final node #%u: %s",
|
|
||||||
onion_wire_name(onionerr),
|
|
||||||
erridx,
|
|
||||||
message);
|
|
||||||
|
|
||||||
if (onionerr == WIRE_MPP_TIMEOUT) {
|
if (onionerr == WIRE_MPP_TIMEOUT) {
|
||||||
return pay_flow_failed(pf);
|
return pay_flow_failed(pf);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_paynote(p,"final destination failure");
|
payflow_note(pf, LOG_INFORM,
|
||||||
|
"final destination permanent failure");
|
||||||
return pay_flow_failed_final(pf, PAY_DESTINATION_PERM_FAIL, message);
|
return pay_flow_failed_final(pf, PAY_DESTINATION_PERM_FAIL, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1229,8 +1222,6 @@ static struct pf_result *sendpay_failure(struct pay_flow *pf,
|
||||||
/* Only one code is really actionable */
|
/* Only one code is really actionable */
|
||||||
switch (errcode) {
|
switch (errcode) {
|
||||||
case PAY_UNPARSEABLE_ONION:
|
case PAY_UNPARSEABLE_ONION:
|
||||||
debug_paynote(pf->payment, "Unparsable onion reply on route %s",
|
|
||||||
flow_path_to_str(tmpctx, pf));
|
|
||||||
return handle_unhandleable_error(pf, "Unparsable onion reply");
|
return handle_unhandleable_error(pf, "Unparsable onion reply");
|
||||||
|
|
||||||
case PAY_TRY_OTHER_ROUTE:
|
case PAY_TRY_OTHER_ROUTE:
|
||||||
|
|
|
@ -220,11 +220,12 @@ static u32 *shadow_additions(const tal_t *ctx,
|
||||||
shadow_delay = shadow_one_flow(gossmap, flows[i],
|
shadow_delay = shadow_one_flow(gossmap, flows[i],
|
||||||
&shadow_fee);
|
&shadow_fee);
|
||||||
if (flow_delay(flows[i]) + shadow_delay > p->maxdelay) {
|
if (flow_delay(flows[i]) + shadow_delay > p->maxdelay) {
|
||||||
debug_paynote(p, "No shadow for flow %zu/%zu:"
|
payment_note(p, LOG_UNUSUAL,
|
||||||
" delay would add %u to %"PRIu64", exceeding max delay.",
|
"No shadow for flow %zu/%zu:"
|
||||||
i, tal_count(flows),
|
" delay would add %u to %"PRIu64", exceeding max delay.",
|
||||||
shadow_delay,
|
i, tal_count(flows),
|
||||||
flow_delay(flows[i]));
|
shadow_delay,
|
||||||
|
flow_delay(flows[i]));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,7 +236,8 @@ static u32 *shadow_additions(const tal_t *ctx,
|
||||||
if (is_entire_payment && tal_count(flows) == 1) {
|
if (is_entire_payment && tal_count(flows) == 1) {
|
||||||
if (!add_to_amounts(gossmap, flows[i], p->maxspend,
|
if (!add_to_amounts(gossmap, flows[i], p->maxspend,
|
||||||
shadow_fee)) {
|
shadow_fee)) {
|
||||||
debug_paynote(p, "No shadow fee for flow %zu/%zu:"
|
payment_note(p, LOG_UNUSUAL,
|
||||||
|
"No shadow fee for flow %zu/%zu:"
|
||||||
" fee would add %s to %s, exceeding budget %s.",
|
" fee would add %s to %s, exceeding budget %s.",
|
||||||
i, tal_count(flows),
|
i, tal_count(flows),
|
||||||
type_to_string(tmpctx, struct amount_msat,
|
type_to_string(tmpctx, struct amount_msat,
|
||||||
|
@ -245,7 +247,8 @@ static u32 *shadow_additions(const tal_t *ctx,
|
||||||
type_to_string(tmpctx, struct amount_msat,
|
type_to_string(tmpctx, struct amount_msat,
|
||||||
&p->maxspend));
|
&p->maxspend));
|
||||||
} else {
|
} else {
|
||||||
debug_paynote(p, "No MPP, so added %s shadow fee",
|
payment_note(p, LOG_DBG,
|
||||||
|
"No MPP, so added %s shadow fee",
|
||||||
type_to_string(tmpctx, struct amount_msat,
|
type_to_string(tmpctx, struct amount_msat,
|
||||||
&shadow_fee));
|
&shadow_fee));
|
||||||
}
|
}
|
||||||
|
@ -444,13 +447,11 @@ const char *add_payflows(const tal_t *ctx,
|
||||||
disabled = make_disabled_bitmap(tmpctx, pay_plugin->gossmap, p->disabled_scids);
|
disabled = make_disabled_bitmap(tmpctx, pay_plugin->gossmap, p->disabled_scids);
|
||||||
src = gossmap_find_node(pay_plugin->gossmap, &pay_plugin->my_id);
|
src = gossmap_find_node(pay_plugin->gossmap, &pay_plugin->my_id);
|
||||||
if (!src) {
|
if (!src) {
|
||||||
debug_paynote(p, "We don't have any channels?");
|
|
||||||
*ecode = PAY_ROUTE_NOT_FOUND;
|
*ecode = PAY_ROUTE_NOT_FOUND;
|
||||||
return tal_fmt(ctx, "We don't have any channels.");
|
return tal_fmt(ctx, "We don't have any channels.");
|
||||||
}
|
}
|
||||||
dst = gossmap_find_node(pay_plugin->gossmap, &p->destination);
|
dst = gossmap_find_node(pay_plugin->gossmap, &p->destination);
|
||||||
if (!dst) {
|
if (!dst) {
|
||||||
debug_paynote(p, "No trace of destination in network gossip");
|
|
||||||
*ecode = PAY_ROUTE_NOT_FOUND;
|
*ecode = PAY_ROUTE_NOT_FOUND;
|
||||||
return tal_fmt(ctx, "Destination is unknown in the network gossip.");
|
return tal_fmt(ctx, "Destination is unknown in the network gossip.");
|
||||||
}
|
}
|
||||||
|
@ -472,10 +473,6 @@ const char *add_payflows(const tal_t *ctx,
|
||||||
p->base_fee_penalty,
|
p->base_fee_penalty,
|
||||||
p->prob_cost_factor);
|
p->prob_cost_factor);
|
||||||
if (!flows) {
|
if (!flows) {
|
||||||
debug_paynote(p,
|
|
||||||
"minflow couldn't find a feasible flow for %s",
|
|
||||||
type_to_string(tmpctx,struct amount_msat,&amount));
|
|
||||||
|
|
||||||
*ecode = PAY_ROUTE_NOT_FOUND;
|
*ecode = PAY_ROUTE_NOT_FOUND;
|
||||||
return tal_fmt(ctx,
|
return tal_fmt(ctx,
|
||||||
"minflow couldn't find a feasible flow for %s",
|
"minflow couldn't find a feasible flow for %s",
|
||||||
|
@ -487,7 +484,7 @@ const char *add_payflows(const tal_t *ctx,
|
||||||
fee = flow_set_fee(flows);
|
fee = flow_set_fee(flows);
|
||||||
delay = flows_worst_delay(flows) + p->final_cltv;
|
delay = flows_worst_delay(flows) + p->final_cltv;
|
||||||
|
|
||||||
debug_paynote(p,
|
payment_note(p, LOG_INFORM,
|
||||||
"we have computed a set of %ld flows with probability %.3lf, fees %s and delay %ld",
|
"we have computed a set of %ld flows with probability %.3lf, fees %s and delay %ld",
|
||||||
tal_count(flows),
|
tal_count(flows),
|
||||||
prob,
|
prob,
|
||||||
|
@ -497,9 +494,6 @@ const char *add_payflows(const tal_t *ctx,
|
||||||
too_expensive = amount_msat_greater(fee, feebudget);
|
too_expensive = amount_msat_greater(fee, feebudget);
|
||||||
if (too_expensive)
|
if (too_expensive)
|
||||||
{
|
{
|
||||||
debug_paynote(p, "Flows too expensive, fee = %s (max %s)",
|
|
||||||
type_to_string(tmpctx, struct amount_msat, &fee),
|
|
||||||
type_to_string(tmpctx, struct amount_msat, &feebudget));
|
|
||||||
*ecode = PAY_ROUTE_TOO_EXPENSIVE;
|
*ecode = PAY_ROUTE_TOO_EXPENSIVE;
|
||||||
return tal_fmt(ctx,
|
return tal_fmt(ctx,
|
||||||
"Fee exceeds our fee budget, "
|
"Fee exceeds our fee budget, "
|
||||||
|
@ -509,12 +503,8 @@ const char *add_payflows(const tal_t *ctx,
|
||||||
}
|
}
|
||||||
too_delayed = (delay > p->maxdelay);
|
too_delayed = (delay > p->maxdelay);
|
||||||
if (too_delayed) {
|
if (too_delayed) {
|
||||||
debug_paynote(p, "Flows too delayed, delay = %"PRIu64" (max %u)",
|
|
||||||
delay, p->maxdelay);
|
|
||||||
|
|
||||||
/* FIXME: What is a sane limit? */
|
/* FIXME: What is a sane limit? */
|
||||||
if (p->delay_feefactor > 1000) {
|
if (p->delay_feefactor > 1000) {
|
||||||
debug_paynote(p, "Giving up!");
|
|
||||||
*ecode = PAY_ROUTE_TOO_EXPENSIVE;
|
*ecode = PAY_ROUTE_TOO_EXPENSIVE;
|
||||||
return tal_fmt(ctx,
|
return tal_fmt(ctx,
|
||||||
"CLTV delay exceeds our CLTV budget, "
|
"CLTV delay exceeds our CLTV budget, "
|
||||||
|
@ -523,8 +513,10 @@ const char *add_payflows(const tal_t *ctx,
|
||||||
}
|
}
|
||||||
|
|
||||||
p->delay_feefactor *= 2;
|
p->delay_feefactor *= 2;
|
||||||
debug_paynote(p, "Doubling delay_feefactor to %f",
|
payment_note(p, LOG_INFORM,
|
||||||
p->delay_feefactor);
|
"delay %"PRIu64" exceeds our max %u, so doubling delay_feefactor to %f",
|
||||||
|
delay, p->maxdelay,
|
||||||
|
p->delay_feefactor);
|
||||||
|
|
||||||
continue; // retry
|
continue; // retry
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,8 @@ struct command_result *payment_fail(
|
||||||
enum jsonrpc_errcode code,
|
enum jsonrpc_errcode code,
|
||||||
const char *fmt, ...)
|
const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
struct command *cmd;
|
||||||
|
|
||||||
/* We usually get called because a flow failed, but we
|
/* We usually get called because a flow failed, but we
|
||||||
* can also get called because we couldn't route any more
|
* can also get called because we couldn't route any more
|
||||||
* or some strange error. */
|
* or some strange error. */
|
||||||
|
@ -231,9 +233,14 @@ struct command_result *payment_fail(
|
||||||
char *message = tal_vfmt(tmpctx,fmt,args);
|
char *message = tal_vfmt(tmpctx,fmt,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
debug_paynote(payment,"%s",message);
|
/* Don't bother notifying command, it's about to get failure */
|
||||||
|
cmd = payment->cmd;
|
||||||
|
payment->cmd = NULL;
|
||||||
|
payment_note(payment, LOG_DBG, "%s", message);
|
||||||
|
/* Restore to keep destructor happy! */
|
||||||
|
payment->cmd = cmd;
|
||||||
|
|
||||||
return command_fail(payment->cmd,code,"%s",message);
|
return command_fail(cmd,code,"%s",message);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 payment_parts(const struct payment *payment)
|
u64 payment_parts(const struct payment *payment)
|
||||||
|
|
Loading…
Add table
Reference in a new issue