File tree Expand file tree Collapse file tree 3 files changed +34
-26
lines changed
Expand file tree Collapse file tree 3 files changed +34
-26
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ PLUGIN_ASKRENE_CHILD_SRC := \
1717 plugins/askrene/child/child_log.c \
1818
1919PLUGIN_ASKRENE_SRC := $(PLUGIN_ASKRENE_PARENT_SRC ) $(PLUGIN_ASKRENE_CHILD_SRC )
20- PLUGIN_ASKRENE_HEADER := $(PLUGIN_ASKRENE_SRC:.c=.h )
20+ PLUGIN_ASKRENE_HEADER := $(PLUGIN_ASKRENE_SRC:.c=.h ) plugins/askrene/child/additional_costs.h
2121
2222PLUGIN_ASKRENE_OBJS := $(PLUGIN_ASKRENE_SRC:.c=.o )
2323
Original file line number Diff line number Diff line change 2222#include <inttypes.h>
2323#include <math.h>
2424#include <plugins/askrene/askrene.h>
25+ #include <plugins/askrene/child/additional_costs.h>
2526#include <plugins/askrene/child/child_log.h>
2627#include <plugins/askrene/child/entry.h>
2728#include <plugins/askrene/layer.h>
2829#include <plugins/askrene/reserve.h>
2930#include <sys/wait.h>
3031#include <wire/wire_sync.h>
3132
32- /* "spendable" for a channel assumes a single HTLC: for additional HTLCs,
33- * the need to pay for fees (if we're the owner) reduces it */
34- struct per_htlc_cost {
35- struct short_channel_id_dir scidd ;
36- struct amount_msat per_htlc_cost ;
37- };
38-
39- static const struct short_channel_id_dir *
40- per_htlc_cost_key (const struct per_htlc_cost * phc )
41- {
42- return & phc -> scidd ;
43- }
44-
45- static inline bool per_htlc_cost_eq_key (const struct per_htlc_cost * phc ,
46- const struct short_channel_id_dir * scidd )
47- {
48- return short_channel_id_dir_eq (scidd , & phc -> scidd );
49- }
50-
51- HTABLE_DEFINE_NODUPS_TYPE (struct per_htlc_cost ,
52- per_htlc_cost_key ,
53- hash_scidd ,
54- per_htlc_cost_eq_key ,
55- additional_cost_htable );
56-
5733static bool have_layer (const char * * layers , const char * name )
5834{
5935 for (size_t i = 0 ; i < tal_count (layers ); i ++ ) {
Original file line number Diff line number Diff line change 1+ #ifndef LIGHTNING_PLUGINS_ASKRENE_CHILD_ADDITIONAL_COSTS_H
2+ #define LIGHTNING_PLUGINS_ASKRENE_CHILD_ADDITIONAL_COSTS_H
3+ #include "config.h"
4+ #include <ccan/htable/htable_type.h>
5+ #include <ccan/tal/tal.h>
6+
7+ /* "spendable" for a channel assumes a single HTLC: for additional HTLCs,
8+ * the need to pay for fees (if we're the owner) reduces it */
9+ struct per_htlc_cost {
10+ struct short_channel_id_dir scidd ;
11+ struct amount_msat per_htlc_cost ;
12+ };
13+
14+ static inline const struct short_channel_id_dir *
15+ per_htlc_cost_key (const struct per_htlc_cost * phc )
16+ {
17+ return & phc -> scidd ;
18+ }
19+
20+ static inline bool per_htlc_cost_eq_key (const struct per_htlc_cost * phc ,
21+ const struct short_channel_id_dir * scidd )
22+ {
23+ return short_channel_id_dir_eq (scidd , & phc -> scidd );
24+ }
25+
26+ HTABLE_DEFINE_NODUPS_TYPE (struct per_htlc_cost ,
27+ per_htlc_cost_key ,
28+ hash_scidd ,
29+ per_htlc_cost_eq_key ,
30+ additional_cost_htable );
31+
32+ #endif /* LIGHTNING_PLUGINS_ASKRENE_CHILD_ADDITIONAL_COSTS_H */
You can’t perform that action at this time.
0 commit comments