Files
palladum-lightning/common/channel_type.h
Rusty Russell 506fa914e0 lightningd: always tell openingd/dualopend what channel type we want.
Prior to it being compulsory, these daemons would need a default value.  Now it's
always required, it's clearer if it's always told.

There's no "default_channel_type" now everyone has to specify channel_type either,
so rename it to "desired_channel_type" and put it in lightningd specifically.

Note that the channel_type can have options added: either option_scid_alias or option_zeroconf.

This results in a slight behavior change: we will get type zeroconf even if we didn't ask for it, if they gave it to us.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: JSON-RPC: fundchannel / fundchannel_start returned `channel_type` will include option_zeroconf if it was implied by a 0 minimum_depth, even if we didn't explicitly ask for a zero conf channel.
2025-08-13 14:20:28 +09:30

46 lines
1.8 KiB
C

/* This represents a channel type: i.e. the sticky feature bits. */
#ifndef LIGHTNING_COMMON_CHANNEL_TYPE_H
#define LIGHTNING_COMMON_CHANNEL_TYPE_H
#include "config.h"
#include <common/features.h>
#include <wire/channel_type_wiregen.h>
/* Explicit channel types */
struct channel_type *channel_type_static_remotekey(const tal_t *ctx);
struct channel_type *channel_type_anchors_zero_fee_htlc(const tal_t *ctx);
/* channel_type variants */
void channel_type_set_zeroconf(struct channel_type *channel_type);
void channel_type_set_scid_alias(struct channel_type *channel_type);
/* Duplicate a channel_type */
struct channel_type *channel_type_dup(const tal_t *ctx,
const struct channel_type *t);
/* Convert feature bits to channel_type */
struct channel_type *channel_type_from(const tal_t *ctx,
const u8 *features TAKES);
/* Does this type include this feature? */
bool channel_type_has(const struct channel_type *type, int feature);
/* Convenience for querying either anchor_outputs or anchors_zero_fee_htlc_tx */
bool channel_type_has_anchors(const struct channel_type *type);
/* Are these two channel_types equivalent? */
bool channel_type_eq(const struct channel_type *a,
const struct channel_type *b);
/* Return channel_type if this is acceptable, otherwise NULL */
struct channel_type *channel_type_accept(const tal_t *ctx,
const u8 *t,
const struct feature_set *our_features);
/* Return an array of feature strings indicating channel type. */
const char **channel_type_name(const tal_t *ctx, const struct channel_type *t);
/* Obsolete channels can exist in db still */
struct channel_type *channel_type_none_obsolete(const tal_t *ctx);
struct channel_type *channel_type_anchor_outputs_obsolete(const tal_t *ctx);
#endif /* LIGHTNING_COMMON_CHANNEL_TYPE_H */