renepay: update test files

This commit is contained in:
Lagrang3 2024-05-06 10:00:03 +01:00 committed by Rusty Russell
parent 16d00e09ef
commit e97e6ede41
8 changed files with 76 additions and 41 deletions

View File

@ -12,7 +12,7 @@ PLUGIN_RENEPAY_TEST_COMMON_OBJS := \
plugins/renepay/dijkstra.o \
plugins/renepay/chan_extra.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
$(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 gossipd/gossip_store_wiregen.o
check-renepay: $(PLUGIN_RENEPAY_TEST_PROGRAMS:%=unittest/%)

View File

@ -14,12 +14,6 @@
#include "../mcf.c"
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_blinded_path */
struct blinded_path *fromwire_blinded_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
{ fprintf(stderr, "fromwire_blinded_path called!\n"); abort(); }
/* Generated stub for towire_blinded_path */
void towire_blinded_path(u8 **p UNNEEDED, const struct blinded_path *blinded_path UNNEEDED)
{ fprintf(stderr, "towire_blinded_path called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
int main(int argc, char *argv[])

View File

@ -351,6 +351,8 @@ int main(int argc, char *argv[])
&errcode,
&err_msg);
assert(routes);
if (!routes) {
printf("get_route failed with error %d: %s", errcode, err_msg);
}

View File

@ -11,12 +11,6 @@
#include <plugins/renepay/dijkstra.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_blinded_path */
struct blinded_path *fromwire_blinded_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
{ fprintf(stderr, "fromwire_blinded_path called!\n"); abort(); }
/* Generated stub for towire_blinded_path */
void towire_blinded_path(u8 **p UNNEEDED, const struct blinded_path *blinded_path UNNEEDED)
{ fprintf(stderr, "towire_blinded_path called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
static void insertion_in_increasing_distance(const tal_t *ctx)

View File

@ -18,23 +18,38 @@
#include <wire/onion_wiregen.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_blinded_path */
struct blinded_path *fromwire_blinded_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
{ fprintf(stderr, "fromwire_blinded_path called!\n"); abort(); }
/* Generated stub for disabledmap_add_channel */
void disabledmap_add_channel(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_add_channel called!\n"); abort(); }
/* Generated stub for disabledmap_add_node */
void disabledmap_add_node(struct disabledmap *p UNNEEDED, struct node_id node UNNEEDED)
{ fprintf(stderr, "disabledmap_add_node called!\n"); abort(); }
/* Generated stub for disabledmap_channel_is_warned */
bool disabledmap_channel_is_warned(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_channel_is_warned called!\n"); abort(); }
/* Generated stub for disabledmap_new */
struct disabledmap *disabledmap_new(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "disabledmap_new called!\n"); abort(); }
/* Generated stub for disabledmap_reset */
void disabledmap_reset(struct disabledmap *p UNNEEDED)
{ fprintf(stderr, "disabledmap_reset called!\n"); abort(); }
/* Generated stub for disabledmap_warn_channel */
void disabledmap_warn_channel(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_warn_channel called!\n"); abort(); }
/* Generated stub for json_add_payment */
void json_add_payment(struct json_stream *s UNNEEDED, const struct payment *payment UNNEEDED)
{ fprintf(stderr, "json_add_payment called!\n"); abort(); }
/* Generated stub for new_routetracker */
struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED)
struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED, struct payment *payment UNNEEDED)
{ fprintf(stderr, "new_routetracker called!\n"); abort(); }
/* Generated stub for pay_plugin */
struct pay_plugin *pay_plugin;
/* Generated stub for routetracker_cleanup */
void routetracker_cleanup(struct routetracker *routetracker UNNEEDED)
{ fprintf(stderr, "routetracker_cleanup called!\n"); abort(); }
/* Generated stub for towire_blinded_path */
void towire_blinded_path(u8 **p UNNEEDED, const struct blinded_path *blinded_path UNNEEDED)
{ fprintf(stderr, "towire_blinded_path called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
static u8 empty_map[] = {

View File

@ -20,23 +20,38 @@
#include <wire/onion_wiregen.h>
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_blinded_path */
struct blinded_path *fromwire_blinded_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
{ fprintf(stderr, "fromwire_blinded_path called!\n"); abort(); }
/* Generated stub for disabledmap_add_channel */
void disabledmap_add_channel(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_add_channel called!\n"); abort(); }
/* Generated stub for disabledmap_add_node */
void disabledmap_add_node(struct disabledmap *p UNNEEDED, struct node_id node UNNEEDED)
{ fprintf(stderr, "disabledmap_add_node called!\n"); abort(); }
/* Generated stub for disabledmap_channel_is_warned */
bool disabledmap_channel_is_warned(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_channel_is_warned called!\n"); abort(); }
/* Generated stub for disabledmap_new */
struct disabledmap *disabledmap_new(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "disabledmap_new called!\n"); abort(); }
/* Generated stub for disabledmap_reset */
void disabledmap_reset(struct disabledmap *p UNNEEDED)
{ fprintf(stderr, "disabledmap_reset called!\n"); abort(); }
/* Generated stub for disabledmap_warn_channel */
void disabledmap_warn_channel(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_warn_channel called!\n"); abort(); }
/* Generated stub for json_add_payment */
void json_add_payment(struct json_stream *s UNNEEDED, const struct payment *payment UNNEEDED)
{ fprintf(stderr, "json_add_payment called!\n"); abort(); }
/* Generated stub for new_routetracker */
struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED)
struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED, struct payment *payment UNNEEDED)
{ fprintf(stderr, "new_routetracker called!\n"); abort(); }
/* Generated stub for pay_plugin */
struct pay_plugin *pay_plugin;
/* Generated stub for routetracker_cleanup */
void routetracker_cleanup(struct routetracker *routetracker UNNEEDED)
{ fprintf(stderr, "routetracker_cleanup called!\n"); abort(); }
/* Generated stub for towire_blinded_path */
void towire_blinded_path(u8 **p UNNEEDED, const struct blinded_path *blinded_path UNNEEDED)
{ fprintf(stderr, "towire_blinded_path called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
static void swap(int *a, int *b)
@ -389,7 +404,7 @@ int main(int argc, char *argv[])
assert(0 && "minflow failed");
}
routes = flows_to_routes(tmpctx, NULL, 1, 1, payment_hash, 10, gossmap, flows);
routes = flows_to_routes(tmpctx, 1, 1, payment_hash, 10, gossmap, flows);
assert(routes);
for (size_t i = 0; i < tal_count(routes); i++) {
uncertainty_commit_htlcs(uncertainty, routes[i]);

View File

@ -48,9 +48,9 @@ static void valgrind_ok1(void)
tal_t *local_ctx = tal(this_ctx,tal_t);
struct routekey key;
struct route *r1 = new_route(local_ctx, NULL, 1, 1, hash,
struct route *r1 = new_route(local_ctx, 1, 1, hash,
AMOUNT_MSAT(0), AMOUNT_MSAT(0));
struct route *r2 = new_route(local_ctx, NULL, 2, 3, hash,
struct route *r2 = new_route(local_ctx, 2, 3, hash,
AMOUNT_MSAT(0), AMOUNT_MSAT(0));
printf("key1 = %s\n", fmt_routekey(local_ctx,&r1->key));

View File

@ -20,23 +20,38 @@
#include "../mcf.c"
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_blinded_path */
struct blinded_path *fromwire_blinded_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
{ fprintf(stderr, "fromwire_blinded_path called!\n"); abort(); }
/* Generated stub for disabledmap_add_channel */
void disabledmap_add_channel(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_add_channel called!\n"); abort(); }
/* Generated stub for disabledmap_add_node */
void disabledmap_add_node(struct disabledmap *p UNNEEDED, struct node_id node UNNEEDED)
{ fprintf(stderr, "disabledmap_add_node called!\n"); abort(); }
/* Generated stub for disabledmap_channel_is_warned */
bool disabledmap_channel_is_warned(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_channel_is_warned called!\n"); abort(); }
/* Generated stub for disabledmap_new */
struct disabledmap *disabledmap_new(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "disabledmap_new called!\n"); abort(); }
/* Generated stub for disabledmap_reset */
void disabledmap_reset(struct disabledmap *p UNNEEDED)
{ fprintf(stderr, "disabledmap_reset called!\n"); abort(); }
/* Generated stub for disabledmap_warn_channel */
void disabledmap_warn_channel(struct disabledmap *p UNNEEDED,
struct short_channel_id scid UNNEEDED)
{ fprintf(stderr, "disabledmap_warn_channel called!\n"); abort(); }
/* Generated stub for json_add_payment */
void json_add_payment(struct json_stream *s UNNEEDED, const struct payment *payment UNNEEDED)
{ fprintf(stderr, "json_add_payment called!\n"); abort(); }
/* Generated stub for new_routetracker */
struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED)
struct routetracker *new_routetracker(const tal_t *ctx UNNEEDED, struct payment *payment UNNEEDED)
{ fprintf(stderr, "new_routetracker called!\n"); abort(); }
/* Generated stub for pay_plugin */
struct pay_plugin *pay_plugin;
/* Generated stub for routetracker_cleanup */
void routetracker_cleanup(struct routetracker *routetracker UNNEEDED)
{ fprintf(stderr, "routetracker_cleanup called!\n"); abort(); }
/* Generated stub for towire_blinded_path */
void towire_blinded_path(u8 **p UNNEEDED, const struct blinded_path *blinded_path UNNEEDED)
{ fprintf(stderr, "towire_blinded_path called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */
static const u8 canned_map[] = {
@ -675,7 +690,7 @@ static void test_flow_to_route(void)
F->dirs[0]=0;
deliver = AMOUNT_MSAT(250000000);
F->amount = deliver;
route = flow_to_route(this_ctx, NULL, 1, 1, payment_hash, 0, gossmap, F);
route = flow_to_route(this_ctx, 1, 1, payment_hash, 0, gossmap, F);
assert(route);
assert(amount_msat_eq(route->hops[0].amount, deliver));
@ -691,7 +706,7 @@ static void test_flow_to_route(void)
F->dirs[1]=0;
deliver = AMOUNT_MSAT(250000000);
F->amount=deliver;
route = flow_to_route(this_ctx, NULL, 1, 1, payment_hash, 0, gossmap, F);
route = flow_to_route(this_ctx, 1, 1, payment_hash, 0, gossmap, F);
assert(route);
assert(amount_msat_eq(route->hops[0].amount, amount_msat(250050016)));
@ -709,7 +724,7 @@ static void test_flow_to_route(void)
F->dirs[2]=0;
deliver = AMOUNT_MSAT(250000000);
F->amount=deliver;
route = flow_to_route(this_ctx, NULL, 1, 1, payment_hash, 0, gossmap, F);
route = flow_to_route(this_ctx, 1, 1, payment_hash, 0, gossmap, F);
assert(route);
assert(amount_msat_eq(route->hops[0].amount, amount_msat(250087534)));
@ -729,7 +744,7 @@ static void test_flow_to_route(void)
F->dirs[3]=0;
deliver = AMOUNT_MSAT(250000000);
F->amount=deliver;
route = flow_to_route(this_ctx, NULL, 1, 1, payment_hash, 0, gossmap, F);
route = flow_to_route(this_ctx, 1, 1, payment_hash, 0, gossmap, F);
assert(route);
assert(amount_msat_eq(route->hops[0].amount, amount_msat(250112544)));