Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
506045d
askrene: add a new graph abstraction
Lagrang3 Oct 15, 2024
a2ecd4d
askrene: add priorityqueue
Lagrang3 Oct 15, 2024
78a1583
askrene: add graph algorithms module
Lagrang3 Oct 16, 2024
15c3377
askrene: add dijkstra algorithm
Lagrang3 Oct 16, 2024
eaca91b
askrene: add algorithm to compute feasible flow
Lagrang3 Oct 16, 2024
6c339f7
askrene: add a simple MCF solver
Lagrang3 Oct 16, 2024
b36f355
askrene algorithm add helper for flow conservation
Lagrang3 Oct 17, 2024
3c87edd
askrene: add a MCF refinement
Lagrang3 Oct 17, 2024
52a5f78
askrene: add bigger test for MCF
Lagrang3 Oct 18, 2024
8b73051
askrene: fix bug, not all arcs exists
Lagrang3 Oct 18, 2024
6777925
askrene: add mcf_refinement to the public API
Lagrang3 Oct 21, 2024
93ab27e
askrene: use the new MCF solver
Lagrang3 Oct 21, 2024
fa8c233
askrene: fix CI
Lagrang3 Oct 21, 2024
b4e5bce
askrene: fix the median
Lagrang3 Oct 22, 2024
624edae
add ratio ceil and floor operators on amount_msat
Lagrang3 Oct 23, 2024
4b842a1
askrene: add arbitrary precision flow unit
Lagrang3 Oct 23, 2024
9049110
askrene: small fixes suggested by Rusty Russell
Lagrang3 Nov 12, 2024
963d59e
askrene: add compiler flag ASKRENE_UNITTEST
Lagrang3 Nov 13, 2024
b925b66
askrene: remove allocation checks
Lagrang3 Nov 13, 2024
d822512
askrene: bugfix queue overflow
Lagrang3 Nov 13, 2024
62cfdba
askrene: don't skip fee_fallback test
Lagrang3 Nov 13, 2024
e0790bb
Askrene: change median factor to 1.
Lagrang3 Nov 14, 2024
6795ff3
pytest: reenable askrene bias test.
rustyrussell Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions common/amount.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,16 @@ double amount_msat_ratio(struct amount_msat a, struct amount_msat b)
return (double)a.millisatoshis / b.millisatoshis;
}

u64 amount_msat_ratio_floor(struct amount_msat a, struct amount_msat b)
{
return a.millisatoshis / b.millisatoshis;
}

u64 amount_msat_ratio_ceil(struct amount_msat a, struct amount_msat b)
{
return (a.millisatoshis + b.millisatoshis - 1) / b.millisatoshis;
}

struct amount_msat amount_msat_div(struct amount_msat msat, u64 div)
{
msat.millisatoshis /= div;
Expand Down
6 changes: 6 additions & 0 deletions common/amount.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ bool amount_msat_eq_sat(struct amount_msat msat, struct amount_sat sat);
/* a / b */
double amount_msat_ratio(struct amount_msat a, struct amount_msat b);

/* floor(a/b) */
u64 amount_msat_ratio_floor(struct amount_msat a, struct amount_msat b);

/* ceil(a/b) */
u64 amount_msat_ratio_ceil(struct amount_msat a, struct amount_msat b);

/* min(a,b) and max(a,b) */
static inline struct amount_msat amount_msat_min(struct amount_msat a,
struct amount_msat b)
Expand Down
4 changes: 4 additions & 0 deletions external/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ else
LDLIBS += -lsodium
endif

ifeq ($(HAVE_ZLIB),1)
LDLIBS += -lz
endif

EXTERNAL_LDLIBS := -L${TARGET_DIR} $(patsubst lib%.a,-l%,$(notdir $(EXTERNAL_LIBS)))

submodcheck: $(FORCE)
Expand Down
30 changes: 28 additions & 2 deletions plugins/askrene/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
PLUGIN_ASKRENE_SRC := plugins/askrene/askrene.c plugins/askrene/layer.c plugins/askrene/reserve.c plugins/askrene/mcf.c plugins/askrene/dijkstra.c plugins/askrene/flow.c plugins/askrene/refine.c plugins/askrene/explain_failure.c
PLUGIN_ASKRENE_HEADER := plugins/askrene/askrene.h plugins/askrene/layer.h plugins/askrene/reserve.h plugins/askrene/mcf.h plugins/askrene/dijkstra.h plugins/askrene/flow.h plugins/askrene/refine.h plugins/askrene/explain_failure.h
PLUGIN_ASKRENE_SRC := \
plugins/askrene/askrene.c \
plugins/askrene/layer.c \
plugins/askrene/reserve.c \
plugins/askrene/mcf.c \
plugins/askrene/dijkstra.c \
plugins/askrene/flow.c \
plugins/askrene/refine.c \
plugins/askrene/explain_failure.c \
plugins/askrene/graph.c \
plugins/askrene/priorityqueue.c \
plugins/askrene/algorithm.c

PLUGIN_ASKRENE_HEADER := \
plugins/askrene/askrene.h \
plugins/askrene/layer.h \
plugins/askrene/reserve.h \
plugins/askrene/mcf.h \
plugins/askrene/dijkstra.h \
plugins/askrene/flow.h \
plugins/askrene/refine.h \
plugins/askrene/explain_failure.h \
plugins/askrene/graph.h \
plugins/askrene/priorityqueue.h \
plugins/askrene/algorithm.h

PLUGIN_ASKRENE_OBJS := $(PLUGIN_ASKRENE_SRC:.c=.o)

$(PLUGIN_ASKRENE_OBJS): $(PLUGIN_ASKRENE_HEADER)
Expand All @@ -8,3 +32,5 @@ PLUGIN_ALL_SRC += $(PLUGIN_ASKRENE_SRC)
PLUGIN_ALL_HEADER += $(PLUGIN_ASKRENE_HEADER)

plugins/cln-askrene: $(PLUGIN_ASKRENE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) bitcoin/chainparams.o common/gossmap.o common/sciddir_or_pubkey.o common/gossmods_listpeerchannels.o common/fp16.o common/dijkstra.o common/bolt12.o common/bolt12_merkle.o wire/bolt12_wiregen.o wire/onion_wiregen.o common/route.o

include plugins/askrene/test/Makefile
Loading
Loading