renepay: remove custom debug, in favor of normal operations.

As a bonus, unit tests no longer leave files in /tmp.

Reported-by: https://github.com/whitslack
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-09-18 14:23:46 +09:30
parent 7c582944bd
commit 577161a4fa
14 changed files with 62 additions and 160 deletions

View File

@@ -1,7 +1,7 @@
PLUGIN_RENEPAY_SRC := plugins/renepay/pay.c plugins/renepay/pay_flow.c plugins/renepay/flow.c plugins/renepay/mcf.c plugins/renepay/dijkstra.c \
plugins/renepay/debug.c plugins/renepay/payment.c plugins/renepay/uncertainty_network.c
plugins/renepay/payment.c plugins/renepay/uncertainty_network.c
PLUGIN_RENEPAY_HDRS := plugins/renepay/pay.h plugins/renepay/pay_flow.h plugins/renepay/flow.h plugins/renepay/mcf.h plugins/renepay/dijkstra.h \
plugins/renepay/debug.h plugins/renepay/payment.h plugins/renepay/uncertainty_network.h
plugins/renepay/payment.h plugins/renepay/uncertainty_network.h
PLUGIN_RENEPAY_OBJS := $(PLUGIN_RENEPAY_SRC:.c=.o)
# Make sure these depend on everything.

View File

@@ -1,51 +0,0 @@
#include "config.h"
#include <plugins/renepay/debug.h>
void _debug_exec_branch(const char* fname,const char* fun, int lineno)
{
FILE *f = fopen(fname,"a");
fprintf(f,"executing line: %d (%s)\n",lineno,fun);
fclose(f);
}
void _debug_outreq(const char *fname, const struct out_req *req)
{
FILE *f = fopen(fname,"a");
size_t len;
const char * str = json_out_contents(req->js->jout,&len);
fprintf(f,"%s",str);
if (req->errcb)
fprintf(f,"}");
fprintf(f,"}\n");
fclose(f);
}
void _debug_call(const char* fname, const char* fun)
{
FILE *f = fopen(fname,"a");
fprintf(f,"calling function: %s\n",fun);
fclose(f);
}
void _debug_reply(const char* fname, const char* buf,const jsmntok_t *toks)
{
FILE *f = fopen(fname,"a");
fprintf(f,"%.*s\n\n",
json_tok_full_len(toks),
json_tok_full(buf, toks));
fclose(f);
}
void _debug_info(const char* fname, const char *fmt, ...)
{
FILE *f = fopen(fname,"a");
va_list args;
va_start(args, fmt);
vfprintf(f,fmt,args);
va_end(args);
fclose(f);
}

View File

@@ -1,48 +0,0 @@
#ifndef LIGHTNING_PLUGINS_RENEPAY_DEBUG_H
#define LIGHTNING_PLUGINS_RENEPAY_DEBUG_H
#include "config.h"
#include <ccan/json_out/json_out.h>
#include <common/json_param.h>
#include <common/json_stream.h>
#include <common/type_to_string.h>
#include <plugins/libplugin.h>
#include <plugins/renepay/pay.h>
#include <stdio.h>
#include <wire/peer_wire.h>
void _debug_outreq(const char *fname, const struct out_req *req);
void _debug_reply(const char* fname, const char* buf,const jsmntok_t *toks);
void _debug_info(const char* fname, const char *fmt, ...);
void _debug_call(const char* fname, const char* fun);
void _debug_exec_branch(const char* fname,const char* fun, int lineno);
#ifndef MYLOG
#define MYLOG "/tmp/debug.txt"
#endif
/* All debug information goes to a file. */
#ifdef RENEPAY_UNITTEST
#define debug_info(...) \
_debug_info(MYLOG,__VA_ARGS__)
#define debug_err(...) \
{_debug_info(MYLOG,__VA_ARGS__); abort();}
#else
/* Debugging information goes either to payment notes or to lightningd log. */
#define debug_info(...) \
plugin_log(pay_plugin->plugin,LOG_DBG,__VA_ARGS__)
#define debug_err(...) \
plugin_err(pay_plugin->plugin,__VA_ARGS__)
#endif
#define debug_assert(expr) \
if(!(expr)) debug_err("Assertion failed %s, file: %s, line %d", #expr,__FILE__,__LINE__)
#endif /* LIGHTNING_PLUGINS_RENEPAY_DEBUG_H */

View File

@@ -5,8 +5,8 @@
#include <ccan/tal/tal.h>
#include <common/type_to_string.h>
#include <math.h>
#include <plugins/renepay/debug.h>
#include <plugins/renepay/flow.h>
#include <plugins/renepay/pay.h>
#include <stdio.h>
#ifndef SUPERVERBOSE
@@ -128,7 +128,8 @@ void chan_extra_adjust_half(struct chan_extra *ce,
{
if(!amount_msat_sub(&ce->half[dir].known_max,ce->capacity,ce->half[!dir].known_min))
{
debug_err("%s cannot substract capacity=%s and known_min=%s",
plugin_err(pay_plugin->plugin,
"%s cannot substract capacity=%s and known_min=%s",
__PRETTY_FUNCTION__,
type_to_string(tmpctx,struct amount_msat,&ce->capacity),
type_to_string(tmpctx,struct amount_msat,&ce->half[!dir].known_min)
@@ -136,7 +137,7 @@ void chan_extra_adjust_half(struct chan_extra *ce,
}
if(!amount_msat_sub(&ce->half[dir].known_min,ce->capacity,ce->half[!dir].known_max))
{
debug_err("%s cannot substract capacity=%s and known_max=%s",
plugin_err(pay_plugin->plugin,"%s cannot substract capacity=%s and known_max=%s",
__PRETTY_FUNCTION__,
type_to_string(tmpctx,struct amount_msat,&ce->capacity),
type_to_string(tmpctx,struct amount_msat,&ce->half[!dir].known_max)
@@ -153,7 +154,7 @@ static void chan_extra_can_send_(
{
if(amount_msat_greater(x,ce->capacity))
{
debug_err("%s unexpected capacity=%s is less than x=%s",
plugin_err(pay_plugin->plugin,"%s unexpected capacity=%s is less than x=%s",
__PRETTY_FUNCTION__,
type_to_string(tmpctx,struct amount_msat,&ce->capacity),
type_to_string(tmpctx,struct amount_msat,&x)
@@ -176,12 +177,12 @@ void chan_extra_can_send(
scidd->scid);
if(!ce)
{
debug_err("%s unexpected chan_extra ce is NULL",
plugin_err(pay_plugin->plugin,"%s unexpected chan_extra ce is NULL",
__PRETTY_FUNCTION__);
}
if(!amount_msat_add(&x,x,ce->half[scidd->dir].htlc_total))
{
debug_err("%s (line %d) cannot add x=%s and htlc_total=%s",
plugin_err(pay_plugin->plugin,"%s (line %d) cannot add x=%s and htlc_total=%s",
__PRETTY_FUNCTION__,__LINE__,
type_to_string(tmpctx,struct amount_msat,&x),
type_to_string(tmpctx,struct amount_msat,&ce->half[scidd->dir].htlc_total));
@@ -201,14 +202,14 @@ void chan_extra_cannot_send(
scidd->scid);
if(!ce)
{
debug_err("%s (line %d) unexpected chan_extra ce is NULL",
plugin_err(pay_plugin->plugin,"%s (line %d) unexpected chan_extra ce is NULL",
__PRETTY_FUNCTION__,__LINE__);
}
/* Note: sent is already included in htlc_total! */
if(!amount_msat_sub(&x,ce->half[scidd->dir].htlc_total,AMOUNT_MSAT(1)))
{
debug_err("%s (line %d) unexpected htlc_total=%s is less than 0msat",
plugin_err(pay_plugin->plugin,"%s (line %d) unexpected htlc_total=%s is less than 0msat",
__PRETTY_FUNCTION__,__LINE__,
type_to_string(tmpctx,struct amount_msat,
&ce->half[scidd->dir].htlc_total)
@@ -246,7 +247,7 @@ static void chan_extra_set_liquidity_(
{
if(amount_msat_greater(x,ce->capacity))
{
debug_err("%s unexpected capacity=%s is less than x=%s",
plugin_err(pay_plugin->plugin,"%s unexpected capacity=%s is less than x=%s",
__PRETTY_FUNCTION__,
type_to_string(tmpctx,struct amount_msat,&ce->capacity),
type_to_string(tmpctx,struct amount_msat,&x)
@@ -268,7 +269,7 @@ void chan_extra_set_liquidity(
scidd->scid);
if(!ce)
{
debug_err("%s unexpected chan_extra ce is NULL",
plugin_err(pay_plugin->plugin,"%s unexpected chan_extra ce is NULL",
__PRETTY_FUNCTION__);
}
chan_extra_set_liquidity_(ce,scidd->dir,x);
@@ -284,13 +285,13 @@ void chan_extra_sent_success(
scidd->scid);
if(!ce)
{
debug_err("%s unexpected chan_extra ce is NULL",
plugin_err(pay_plugin->plugin,"%s unexpected chan_extra ce is NULL",
__PRETTY_FUNCTION__);
}
if(amount_msat_greater(x,ce->capacity))
{
debug_err("%s unexpected capacity=%s is less than x=%s",
plugin_err(pay_plugin->plugin,"%s unexpected capacity=%s is less than x=%s",
__PRETTY_FUNCTION__,
type_to_string(tmpctx,struct amount_msat,&ce->capacity),
type_to_string(tmpctx,struct amount_msat,&x)
@@ -349,7 +350,7 @@ void chan_extra_relax(
scidd->scid);
if(!ce)
{
debug_err("%s unexpected chan_extra ce is NULL",
plugin_err(pay_plugin->plugin,"%s unexpected chan_extra ce is NULL",
__PRETTY_FUNCTION__);
}
chan_extra_relax_(ce,scidd->dir,x,y);
@@ -427,7 +428,7 @@ get_chan_extra_half_by_chan_verify(
if (!gossmap_chan_get_capacity(gossmap,chan, &cap) ||
!amount_sat_to_msat(&cap_msat, cap))
{
debug_err("%s (line %d) unable convert sat to msat or "
plugin_err(pay_plugin->plugin,"%s (line %d) unable convert sat to msat or "
"get channel capacity",
__PRETTY_FUNCTION__,
__LINE__);
@@ -488,7 +489,7 @@ static double edge_probability(struct amount_msat min, struct amount_msat max,
// one past the last known value, makes computations simpler
if(!amount_msat_add(&B,B,one))
{
debug_err("%s (line %d) cannot add B=%s and %s",
plugin_err(pay_plugin->plugin,"%s (line %d) cannot add B=%s and %s",
__PRETTY_FUNCTION__,
__LINE__,
type_to_string(this_ctx, struct amount_msat, &B),
@@ -497,7 +498,7 @@ static double edge_probability(struct amount_msat min, struct amount_msat max,
// in_flight cannot be greater than max
if(!amount_msat_sub(&B,B,in_flight))
{
debug_err("%s (line %d) in_flight=%s cannot be greater than B=%s",
plugin_err(pay_plugin->plugin,"%s (line %d) in_flight=%s cannot be greater than B=%s",
__PRETTY_FUNCTION__,
__LINE__,
type_to_string(this_ctx, struct amount_msat, &in_flight),
@@ -513,7 +514,7 @@ static double edge_probability(struct amount_msat min, struct amount_msat max,
// B cannot be smaller than or equal A
if(!amount_msat_sub(&denominator,B,A) || amount_msat_less_eq(B,A))
{
debug_err("%s (line %d) B=%s must be greater than A=%s",
plugin_err(pay_plugin->plugin,"%s (line %d) B=%s must be greater than A=%s",
__PRETTY_FUNCTION__,
__LINE__,
type_to_string(this_ctx, struct amount_msat, &B),
@@ -545,7 +546,7 @@ void remove_completed_flow(const struct gossmap *gossmap,
flow->dirs[i]);
if (!amount_msat_sub(&h->htlc_total, h->htlc_total, flow->amounts[i]))
{
debug_err("%s could not substract HTLC amounts, "
plugin_err(pay_plugin->plugin,"%s could not substract HTLC amounts, "
"half total htlc amount = %s, "
"flow->amounts[%lld] = %s.",
__PRETTY_FUNCTION__,
@@ -555,7 +556,7 @@ void remove_completed_flow(const struct gossmap *gossmap,
}
if (h->num_htlcs == 0)
{
debug_err("%s could not decrease HTLC count.",
plugin_err(pay_plugin->plugin,"%s could not decrease HTLC count.",
__PRETTY_FUNCTION__);
}
h->num_htlcs--;
@@ -586,7 +587,7 @@ void commit_flow(
flow->dirs[i]);
if (!amount_msat_add(&h->htlc_total, h->htlc_total, flow->amounts[i]))
{
debug_err("%s could not add HTLC amounts, "
plugin_err(pay_plugin->plugin,"%s could not add HTLC amounts, "
"flow->amounts[%lld] = %s.",
__PRETTY_FUNCTION__,
i,
@@ -631,7 +632,7 @@ void flow_complete(struct flow *flow,
if(!h)
{
debug_err("%s unexpected chan_extra_half is NULL",
plugin_err(pay_plugin->plugin,"%s unexpected chan_extra_half is NULL",
__PRETTY_FUNCTION__);
}
@@ -645,7 +646,7 @@ void flow_complete(struct flow *flow,
flow_edge(flow, i)->base_fee,
flow_edge(flow, i)->proportional_fee))
{
debug_err("%s fee overflow",
plugin_err(pay_plugin->plugin,"%s fee overflow",
__PRETTY_FUNCTION__);
}
}
@@ -716,7 +717,7 @@ double flow_set_probability(
struct amount_msat prev_flow;
if(!amount_msat_add(&prev_flow,h->htlc_total,in_flight[c_idx].half[c_dir]))
{
debug_err("%s (line %d) in-flight amount_msat overflow",
plugin_err(pay_plugin->plugin,"%s (line %d) in-flight amount_msat overflow",
__PRETTY_FUNCTION__,
__LINE__);
}
@@ -728,7 +729,7 @@ double flow_set_probability(
in_flight[c_idx].half[c_dir],
deliver))
{
debug_err("%s (line %d) in-flight amount_msat overflow",
plugin_err(pay_plugin->plugin,"%s (line %d) in-flight amount_msat overflow",
__PRETTY_FUNCTION__,
__LINE__);
}
@@ -810,7 +811,7 @@ static void get_medians(const struct gossmap *gossmap,
*median_capacity = amount;
else if (!amount_sat_to_msat(median_capacity, caps[num_caps / 2]))
{
debug_err("%s (line %d) amount_msat overflow",
plugin_err(pay_plugin->plugin,"%s (line %d) amount_msat overflow",
__PRETTY_FUNCTION__,
__LINE__);
}
@@ -877,13 +878,13 @@ struct amount_msat flow_set_fee(struct flow **flows)
flows[i]->amounts[0],
flows[i]->amounts[n-1]))
{
debug_err("%s (line %d) amount_msat overflow",
plugin_err(pay_plugin->plugin,"%s (line %d) amount_msat overflow",
__PRETTY_FUNCTION__,
__LINE__);
}
if(!amount_msat_add(&fee, this_fee,fee))
{
debug_err("%s (line %d) amount_msat overflow",
plugin_err(pay_plugin->plugin,"%s (line %d) amount_msat overflow",
__PRETTY_FUNCTION__,
__LINE__);
}

View File

@@ -5,10 +5,10 @@
#include <ccan/tal/tal.h>
#include <common/type_to_string.h>
#include <math.h>
#include <plugins/renepay/debug.h>
#include <plugins/renepay/dijkstra.h>
#include <plugins/renepay/flow.h>
#include <plugins/renepay/mcf.h>
#include <plugins/renepay/pay.h>
#include <stdint.h>
/* # Optimal payments
@@ -457,7 +457,7 @@ static void linearize_channel(
if(!extra_half)
{
debug_err("%s (line %d) unexpected, extra_half is NULL",
plugin_err(pay_plugin->plugin,"%s (line %d) unexpected, extra_half is NULL",
__PRETTY_FUNCTION__,
__LINE__);
}
@@ -1242,7 +1242,7 @@ static struct flow **
struct amount_msat delivered = amount_msat(delta*1000);
if(!amount_msat_sub(&delivered,delivered,excess))
{
debug_err("%s (line %d) unable to substract excess.",
plugin_err(pay_plugin->plugin,"%s (line %d) unable to substract excess.",
__PRETTY_FUNCTION__,
__LINE__);
}

View File

@@ -12,7 +12,6 @@
#include <common/pseudorand.h>
#include <common/type_to_string.h>
#include <errno.h>
#include <plugins/renepay/debug.h>
#include <plugins/renepay/pay.h>
#include <plugins/renepay/pay_flow.h>
#include <plugins/renepay/uncertainty_network.h>
@@ -38,7 +37,7 @@ void amount_msat_accumulate_(struct amount_msat *dst,
{
if (amount_msat_add(dst, *dst, src))
return;
debug_err("Overflow adding %s (%s) into %s (%s)",
plugin_err(pay_plugin->plugin,"Overflow adding %s (%s) into %s (%s)",
srcname, type_to_string(tmpctx, struct amount_msat, &src),
dstname, type_to_string(tmpctx, struct amount_msat, dst));
}
@@ -50,7 +49,7 @@ void amount_msat_reduce_(struct amount_msat *dst,
{
if (amount_msat_sub(dst, *dst, src))
return;
debug_err("Underflow subtracting %s (%s) from %s (%s)",
plugin_err(pay_plugin->plugin,"Underflow subtracting %s (%s) from %s (%s)",
srcname, type_to_string(tmpctx, struct amount_msat, &src),
dstname, type_to_string(tmpctx, struct amount_msat, dst));
}
@@ -285,7 +284,7 @@ static struct command_result *flow_sendpay_failed(struct command *cmd,
plugin_log(pay_plugin->plugin,LOG_DBG,"calling %s",__PRETTY_FUNCTION__);
debug_assert(payment);
assert(payment);
if (json_scan(tmpctx, buf, err,
"{code:%,message:%}",
@@ -555,7 +554,7 @@ static struct command_result *json_paystatus(struct command *cmd,
{
case PAYMENT_SUCCESS:
json_add_string(ret,"status","complete");
debug_assert(p->preimage);
assert(p->preimage);
json_add_preimage(ret,"payment_preimage",p->preimage);
json_add_amount_msat(ret, "amount_sent_msat", p->total_sent);
@@ -599,8 +598,6 @@ payment_listsendpays_previous(
const jsmntok_t *result,
struct payment * payment)
{
debug_info("calling %s",__PRETTY_FUNCTION__);
size_t i;
const jsmntok_t *t, *arr;
@@ -654,10 +651,10 @@ payment_listsendpays_previous(
if (streq(status, "complete")) {
/* Now we know the payment completed. */
if(!amount_msat_add(&complete_msat,complete_msat,this_msat))
debug_err("%s (line %d) msat overflow.",
plugin_err(pay_plugin->plugin,"%s (line %d) msat overflow.",
__PRETTY_FUNCTION__,__LINE__);
if(!amount_msat_add(&complete_sent,complete_sent,this_sent))
debug_err("%s (line %d) msat overflow.",
plugin_err(pay_plugin->plugin,"%s (line %d) msat overflow.",
__PRETTY_FUNCTION__,__LINE__);
json_scan(tmpctx, buf, t,
"{created_at:%"
@@ -1039,7 +1036,7 @@ static struct pf_result *handle_sendpay_failure_payment(struct pay_flow *pf STEA
struct short_channel_id errscid;
const u8 *update;
debug_assert(pf);
assert(pf);
/* Final node is usually a hard failure */
if (erridx == tal_count(pf->path_scidds)) {
@@ -1121,7 +1118,7 @@ static void handle_sendpay_failure_flow(struct pay_flow *pf,
u32 erridx,
u32 onionerr)
{
debug_assert(pf);
assert(pf);
/* we know that all channels before erridx where able to commit to this payment */
uncertainty_network_channel_can_send(

View File

@@ -1,9 +1,9 @@
/* Routines to get suitable pay_flow array from pay constraints */
#include "config.h"
#include <bitcoin/preimage.h>
#include <ccan/tal/str/str.h>
#include <common/gossmap.h>
#include <common/pseudorand.h>
#include <common/type_to_string.h>
#include <errno.h>
#include <plugins/libplugin.h>
#include <plugins/renepay/mcf.h>

View File

@@ -3,8 +3,8 @@
#include "config.h"
#include <ccan/ccan/tal/str/str.h>
#include <ccan/short_types/short_types.h>
#include <common/type_to_string.h>
#include <common/utils.h>
#include <plugins/renepay/debug.h>
#include <plugins/renepay/flow.h>
#include <plugins/renepay/payment.h>

View File

@@ -1,7 +1,10 @@
#include "config.h"
#include <bitcoin/preimage.h>
#include <bitcoin/privkey.h>
#include <ccan/ccan/tal/str/str.h>
#include <common/json_stream.h>
#include <common/memleak.h>
#include <plugins/renepay/debug.h>
#include <plugins/renepay/pay.h>
#include <plugins/renepay/pay_flow.h>
#include <plugins/renepay/payment.h>
@@ -127,7 +130,7 @@ struct amount_msat payment_fees(const struct payment *p)
delivered = payment_delivered(p);
if(!amount_msat_sub(&fees,sent,delivered))
debug_err( "Strange, sent amount (%s) is less than delivered (%s), aborting.",
plugin_err(pay_plugin->plugin, "Strange, sent amount (%s) is less than delivered (%s), aborting.",
type_to_string(tmpctx,struct amount_msat,&sent),
type_to_string(tmpctx,struct amount_msat,&delivered));
return fees;
@@ -171,7 +174,7 @@ void payment_assert_delivering_incomplete(const struct payment *p)
{
if(!amount_msat_less(p->total_delivering, p->amount))
{
debug_err(
plugin_err(pay_plugin->plugin,
"Strange, delivering (%s) is not smaller than amount (%s)",
type_to_string(tmpctx,struct amount_msat,&p->total_delivering),
type_to_string(tmpctx,struct amount_msat,&p->amount));
@@ -181,7 +184,7 @@ void payment_assert_delivering_all(const struct payment *p)
{
if(amount_msat_less(p->total_delivering, p->amount))
{
debug_err(
plugin_err(pay_plugin->plugin,
"Strange, delivering (%s) is less than amount (%s)",
type_to_string(tmpctx,struct amount_msat,&p->total_delivering),
type_to_string(tmpctx,struct amount_msat,&p->amount));

View File

@@ -9,8 +9,7 @@ ALL_TEST_PROGRAMS += $(PLUGIN_RENEPAY_TEST_PROGRAMS)
$(PLUGIN_RENEPAY_TEST_OBJS): $(PLUGIN_RENEPAY_SRC)
PLUGIN_RENEPAY_TEST_COMMON_OBJS := \
plugins/renepay/dijkstra.o \
plugins/renepay/debug.o
plugins/renepay/dijkstra.o
$(PLUGIN_RENEPAY_TEST_PROGRAMS): $(PLUGIN_RENEPAY_TEST_COMMON_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12$(EXP)_wiregen.o

View File

@@ -54,8 +54,7 @@ static const char* print_flows(
delivered = flows[i]->amounts[tal_count(flows[i]->amounts)-1];
if (!amount_msat_sub(&fee, flows[i]->amounts[0], delivered))
{
debug_err("%s: flow[i]->amount[0]<delivered\n",
__PRETTY_FUNCTION__);
abort();
}
tal_append_fmt(&buff," prob %.2f, %s delivered with fee %s\n",
flows[i]->success_prob,
@@ -159,7 +158,7 @@ int main(int argc, char *argv[])
/* base fee penalty */ 0,
/* prob cost factor = */ 1);
debug_info("%s\n",
printf("%s\n",
print_flows(tmpctx,"Simple minflow", gossmap,chan_extra_map, flows));
common_shutdown();

View File

@@ -320,8 +320,8 @@ int main(int argc, char *argv[])
/* base fee penalty */ 1,
/* prob cost factor = */ 10);
commit_flow_set(gossmap,chan_extra_map,flows);
debug_info("%s\n",
print_flows(tmpctx,"Flow via single path l1->l2->l3", gossmap, flows));
printf("%s\n",
print_flows(tmpctx,"Flow via single path l1->l2->l3", gossmap, flows));
@@ -465,7 +465,7 @@ int main(int argc, char *argv[])
/* delay fee factor = */ 1,
/* base fee penalty */ 1,
/* prob cost factor = */ 10);
debug_info("%s\n",
printf("%s\n",
print_flows(tmpctx,"Flow via two paths, high mu", gossmap, flows2));
assert(tal_count(flows2) == 2);

View File

@@ -1,5 +1,6 @@
#include "config.h"
#include <plugins/renepay/debug.h>
#include <common/bolt11.h>
#include <plugins/renepay/pay.h>
#include <plugins/renepay/uncertainty_network.h>
static bool chan_extra_check_invariants(struct chan_extra *ce)
@@ -140,7 +141,7 @@ void uncertainty_network_update(
struct chan_extra *ce = chan_extra_map_get(chan_extra_map,del_list[i]);
if(!ce)
{
debug_err("%s (line %d) unexpected chan_extra ce is NULL",
plugin_err(pay_plugin->plugin,"%s (line %d) unexpected chan_extra ce is NULL",
__PRETTY_FUNCTION__,
__LINE__);
}
@@ -168,13 +169,13 @@ void uncertainty_network_update(
if(!gossmap_chan_get_capacity(gossmap,chan,&cap))
{
debug_err("%s (line %d) unable to fetch channel capacity",
plugin_err(pay_plugin->plugin,"%s (line %d) unable to fetch channel capacity",
__PRETTY_FUNCTION__,
__LINE__);
}
if(!amount_sat_to_msat(&cap_msat,cap))
{
debug_err("%s (line %d) unable convert sat to msat",
plugin_err(pay_plugin->plugin,"%s (line %d) unable convert sat to msat",
__PRETTY_FUNCTION__,
__LINE__);
}

View File

@@ -7,6 +7,7 @@
#include <plugins/renepay/payment.h>
struct pay_flow;
struct route_info;
/* Checks the entire uncertainty network for invariant violations. */
bool uncertainty_network_check_invariants(struct chan_extra_map *chan_extra_map);