Files
palladum-lightning/common/gossmods_listpeerchannels.h
Rusty Russell f6a4e79420 global: remove unnecessary includes from headers.
Each header should only include the other headers it needs to compile;
`devtools/reduce-includes.sh */*.h` does this.  The C files then need
additional includes if they don't compile.

And remove the entirely useless wire/onion_wire.h, which only serves to include wire/onion_wiregen.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-10-23 06:44:04 +10:30

85 lines
3.0 KiB
C

#ifndef LIGHTNING_COMMON_GOSSMODS_LISTPEERCHANNELS_H
#define LIGHTNING_COMMON_GOSSMODS_LISTPEERCHANNELS_H
#include "config.h"
#include <bitcoin/short_channel_id.h>
#include <common/amount.h>
#include <common/json_parse_simple.h>
struct node_id;
/**
* gossmods_from_listpeerchannels: create gossmap_localmods from `listpeerchannels`
* @ctx: context to allocate return from
* @buf: the JSON buffer from listpeerchannels
* @toks: the JSON tokens
* @zero_rates: set fees and cltv delay for these channels to 0 (better for routing)
* @cb: optional per-channel callback.
* @cbarg: arg for @cb.
*
* This constructs a set of modifications you can apply to your gossmap to include
* local (esp. private) channels. You can also have an optional per-channel callback
* for special effects.
*/
struct gossmap_localmods *gossmods_from_listpeerchannels_(const tal_t *ctx,
const struct node_id *self,
const char *buf,
const jsmntok_t *toks,
bool zero_rates,
void (*cb)(struct gossmap_localmods *mods,
const struct node_id *self_,
const struct node_id *peer,
const struct short_channel_id_dir *scidd,
struct amount_msat capacity_msat,
struct amount_msat htlcmin,
struct amount_msat htlcmax,
struct amount_msat spendable,
struct amount_msat total_htlcmax,
struct amount_msat fee_base,
u32 fee_proportional,
u16 cltv_delta,
bool enabled,
const char *buf_,
const jsmntok_t *chantok,
void *cbarg_),
void *cbarg);
#define gossmods_from_listpeerchannels(ctx, self, buf, toks, zero_rates, cb, cbarg) \
gossmods_from_listpeerchannels_((ctx), (self), (buf), (toks), (zero_rates), \
typesafe_cb_preargs(void, void *, (cb), (cbarg), \
struct gossmap_localmods *, \
const struct node_id *, \
const struct node_id *, \
const struct short_channel_id_dir *, \
struct amount_msat, \
struct amount_msat, \
struct amount_msat, \
struct amount_msat, \
struct amount_msat, \
struct amount_msat, \
u32, \
u16, \
bool, \
const char *, \
const jsmntok_t *), \
(cbarg))
/* Callback which simply adds to gossmap. */
void gossmod_add_localchan(struct gossmap_localmods *mods,
const struct node_id *self,
const struct node_id *peer,
const struct short_channel_id_dir *scidd,
struct amount_msat capacity_msat,
struct amount_msat htlcmin,
struct amount_msat htlcmax,
struct amount_msat spendable,
struct amount_msat total_htlcmax,
struct amount_msat fee_base,
u32 fee_proportional,
u16 cltv_delta,
bool enabled,
const char *buf UNUSED,
const jsmntok_t *chantok UNUSED,
void *cbarg UNUSED);
#endif /* LIGHTNING_COMMON_GOSSMODS_LISTPEERCHANNELS_H */