mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-24 16:24:22 +01:00
common/channel_type: wrapper for generated 'struct channel_type'.
We make it a first-class citizen internally, even though we won't use it over the wire (at least, non-experimental builds). This scheme follows the latest draft, in which features are flagged compulsory. We also add several helper functions. Since uses the *even* bits (as per latest spec), not the *odd* bits, we have some other fixups. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
1b8551923d
commit
cb22015b2a
@@ -17,6 +17,7 @@ COMMON_SRC_NOGEN := \
|
||||
common/bolt12_merkle.c \
|
||||
common/channel_config.c \
|
||||
common/channel_id.c \
|
||||
common/channel_type.c \
|
||||
common/coin_mvt.c \
|
||||
common/close_tx.c \
|
||||
common/configdir.c \
|
||||
|
||||
143
common/channel_type.c
Normal file
143
common/channel_type.c
Normal file
@@ -0,0 +1,143 @@
|
||||
#include <ccan/array_size/array_size.h>
|
||||
#include <common/channel_type.h>
|
||||
|
||||
/* BOLT-channel-types #2:
|
||||
* Channel types are an explicit enumeration: for convenience of future
|
||||
* definitions they reuse even feature bits, but they are not an
|
||||
* arbitrary combination (they represent the persistent features which
|
||||
* affect the channel operation).
|
||||
*
|
||||
* The currently defined types are:
|
||||
* - no features (no bits set)
|
||||
* - `option_static_remotekey` (bit 12)
|
||||
* - `option_anchor_outputs` and `option_static_remotekey` (bits 20 and 12)
|
||||
* - `option_anchors_zero_fee_htlc_tx` and `option_static_remotekey` (bits 22
|
||||
* and 12)
|
||||
*/
|
||||
struct channel_type *channel_type_none(const tal_t *ctx)
|
||||
{
|
||||
struct channel_type *type = tal(ctx, struct channel_type);
|
||||
|
||||
type->features = tal_arr(type, u8, 0);
|
||||
return type;
|
||||
}
|
||||
|
||||
struct channel_type *channel_type_static_remotekey(const tal_t *ctx)
|
||||
{
|
||||
struct channel_type *type = channel_type_none(ctx);
|
||||
|
||||
set_feature_bit(&type->features,
|
||||
COMPULSORY_FEATURE(OPT_STATIC_REMOTEKEY));
|
||||
return type;
|
||||
}
|
||||
|
||||
struct channel_type *channel_type_anchor_outputs(const tal_t *ctx)
|
||||
{
|
||||
struct channel_type *type = channel_type_none(ctx);
|
||||
|
||||
set_feature_bit(&type->features,
|
||||
COMPULSORY_FEATURE(OPT_ANCHOR_OUTPUTS));
|
||||
set_feature_bit(&type->features,
|
||||
COMPULSORY_FEATURE(OPT_STATIC_REMOTEKEY));
|
||||
return type;
|
||||
}
|
||||
|
||||
struct channel_type *default_channel_type(const tal_t *ctx,
|
||||
const struct feature_set *our_features,
|
||||
const u8 *their_features)
|
||||
{
|
||||
/* BOLT-channel-types #2:
|
||||
* Both peers:
|
||||
* - if `channel_type` was present in both `open_channel` and `accept_channel`:
|
||||
* - This is the `channel_type` (they must be equal, required above)
|
||||
* - otherwise:
|
||||
*/
|
||||
/* BOLT-channel-types #2:
|
||||
* - otherwise, if `option_anchor_outputs` was negotiated:
|
||||
* - the `channel_type` is `option_anchor_outputs` and
|
||||
* `option_static_remotekey` (bits 20 and 12)
|
||||
*/
|
||||
if (feature_negotiated(our_features, their_features,
|
||||
OPT_ANCHOR_OUTPUTS))
|
||||
return channel_type_anchor_outputs(ctx);
|
||||
/* BOLT-channel-types #2:
|
||||
* - otherwise, if `option_static_remotekey` was negotiated:
|
||||
* - the `channel_type` is `option_static_remotekey` (bit 12)
|
||||
*/
|
||||
else if (feature_negotiated(our_features, their_features,
|
||||
OPT_STATIC_REMOTEKEY))
|
||||
return channel_type_static_remotekey(ctx);
|
||||
/* BOLT-channel-types #2:
|
||||
* - otherwise:
|
||||
* - the `channel_type` is empty
|
||||
*/
|
||||
else
|
||||
return channel_type_none(ctx);
|
||||
}
|
||||
|
||||
bool channel_type_has(const struct channel_type *type, int feature)
|
||||
{
|
||||
return feature_offered(type->features, feature);
|
||||
}
|
||||
|
||||
bool channel_type_eq(const struct channel_type *a,
|
||||
const struct channel_type *b)
|
||||
{
|
||||
return featurebits_eq(a->features, b->features);
|
||||
}
|
||||
|
||||
bool channel_type_eq_any(const struct channel_type *t,
|
||||
struct channel_type **arr)
|
||||
{
|
||||
for (size_t i = 0; i < tal_count(arr); i++) {
|
||||
if (channel_type_eq(t, arr[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
struct channel_type *channel_type_dup(const tal_t *ctx,
|
||||
const struct channel_type *t)
|
||||
{
|
||||
struct channel_type *ret = tal(ctx, struct channel_type);
|
||||
ret->features = tal_dup_talarr(ret, u8, t->features);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct channel_type *channel_type_accept(const tal_t *ctx,
|
||||
const u8 *t,
|
||||
const struct feature_set *our_features,
|
||||
const u8 *their_features)
|
||||
{
|
||||
struct channel_type *ctype;
|
||||
static const size_t feats[] = { OPT_ANCHOR_OUTPUTS,
|
||||
OPT_STATIC_REMOTEKEY };
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(feats); i++) {
|
||||
size_t f = feats[i];
|
||||
|
||||
if (feature_offered(t, f)) {
|
||||
/* If we don't offer a feature, we don't allow it. */
|
||||
if (!feature_offered(our_features->bits[INIT_FEATURE], f))
|
||||
return NULL;
|
||||
} else {
|
||||
/* We assume that if we *require* a feature, we require
|
||||
* channels have that. */
|
||||
if (feature_is_set(our_features->bits[INIT_FEATURE],
|
||||
COMPULSORY_FEATURE(f)))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Otherwise, just needs to be a known channel type. */
|
||||
ctype = channel_type_none(tmpctx);
|
||||
if (featurebits_eq(t, ctype->features))
|
||||
return tal_steal(ctx, ctype);
|
||||
ctype = channel_type_static_remotekey(tmpctx);
|
||||
if (featurebits_eq(t, ctype->features))
|
||||
return tal_steal(ctx, ctype);
|
||||
ctype = channel_type_anchor_outputs(tmpctx);
|
||||
if (featurebits_eq(t, ctype->features))
|
||||
return tal_steal(ctx, ctype);
|
||||
return NULL;
|
||||
}
|
||||
38
common/channel_type.h
Normal file
38
common/channel_type.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* 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_none(const tal_t *ctx);
|
||||
struct channel_type *channel_type_static_remotekey(const tal_t *ctx);
|
||||
struct channel_type *channel_type_anchor_outputs(const tal_t *ctx);
|
||||
|
||||
/* Duplicate a channel_type */
|
||||
struct channel_type *channel_type_dup(const tal_t *ctx,
|
||||
const struct channel_type *t);
|
||||
|
||||
/* Derive channel type from feature negotiation */
|
||||
struct channel_type *default_channel_type(const tal_t *ctx,
|
||||
const struct feature_set *our_features,
|
||||
const u8 *their_features);
|
||||
|
||||
/* Does this type include this feature? */
|
||||
bool channel_type_has(const struct channel_type *type, int feature);
|
||||
|
||||
/* Are these two channel_types equivalent? */
|
||||
bool channel_type_eq(const struct channel_type *a,
|
||||
const struct channel_type *b);
|
||||
|
||||
/* Is channel_type_eq() for any type in this array? */
|
||||
bool channel_type_eq_any(const struct channel_type *t,
|
||||
struct channel_type **arr);
|
||||
|
||||
/* 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,
|
||||
const u8 *their_features);
|
||||
#endif /* LIGHTNING_COMMON_CHANNEL_TYPE_H */
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <ccan/cast/cast.h>
|
||||
#include <ccan/tal/str/str.h>
|
||||
#include <common/blockheight_states.h>
|
||||
#include <common/features.h>
|
||||
#include <common/channel_type.h>
|
||||
#include <common/fee_states.h>
|
||||
#include <common/initial_channel.h>
|
||||
#include <common/initial_commit_tx.h>
|
||||
@@ -169,53 +169,15 @@ u32 channel_blockheight(const struct channel *channel, enum side side)
|
||||
channel->opener, side);
|
||||
}
|
||||
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
/* BOLT-upgrade_protocol #2:
|
||||
* Channel features are explicitly enumerated as `channel_type` bitfields,
|
||||
* using odd features bits. The currently defined types are:
|
||||
* - no features (no bits set)
|
||||
* - `option_static_remotekey` (bit 13)
|
||||
* - `option_anchor_outputs` and `option_static_remotekey` (bits 21 and 13)
|
||||
* - `option_anchors_zero_fee_htlc_tx` and `option_static_remotekey` (bits 23
|
||||
* and 13)
|
||||
*/
|
||||
static struct channel_type *new_channel_type(const tal_t *ctx)
|
||||
struct channel_type *current_channel_type(const tal_t *ctx,
|
||||
const struct channel *channel)
|
||||
{
|
||||
struct channel_type *type = tal(ctx, struct channel_type);
|
||||
if (channel->option_anchor_outputs)
|
||||
return channel_type_anchor_outputs(ctx);
|
||||
if (channel->option_static_remotekey)
|
||||
return channel_type_static_remotekey(ctx);
|
||||
|
||||
type->features = tal_arr(type, u8, 0);
|
||||
return type;
|
||||
}
|
||||
|
||||
static struct channel_type *type_static_remotekey(const tal_t *ctx)
|
||||
{
|
||||
struct channel_type *type = new_channel_type(ctx);
|
||||
|
||||
set_feature_bit(&type->features,
|
||||
OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY));
|
||||
return type;
|
||||
}
|
||||
|
||||
static struct channel_type *type_anchor_outputs(const tal_t *ctx)
|
||||
{
|
||||
struct channel_type *type = new_channel_type(ctx);
|
||||
|
||||
set_feature_bit(&type->features,
|
||||
OPTIONAL_FEATURE(OPT_ANCHOR_OUTPUTS));
|
||||
set_feature_bit(&type->features,
|
||||
OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY));
|
||||
return type;
|
||||
}
|
||||
|
||||
struct channel_type *channel_type(const tal_t *ctx,
|
||||
const struct channel *channel)
|
||||
{
|
||||
if (channel->option_anchor_outputs)
|
||||
return type_anchor_outputs(ctx);
|
||||
if (channel->option_static_remotekey)
|
||||
return type_static_remotekey(ctx);
|
||||
|
||||
return new_channel_type(ctx);
|
||||
return channel_type_none(ctx);
|
||||
}
|
||||
|
||||
struct channel_type **channel_upgradable_types(const tal_t *ctx,
|
||||
@@ -224,7 +186,7 @@ struct channel_type **channel_upgradable_types(const tal_t *ctx,
|
||||
struct channel_type **arr = tal_arr(ctx, struct channel_type *, 0);
|
||||
|
||||
if (!channel->option_static_remotekey)
|
||||
tal_arr_expand(&arr, type_static_remotekey(arr));
|
||||
tal_arr_expand(&arr, channel_type_static_remotekey(arr));
|
||||
|
||||
return arr;
|
||||
}
|
||||
@@ -234,12 +196,11 @@ struct channel_type *channel_desired_type(const tal_t *ctx,
|
||||
{
|
||||
/* We don't actually want to downgrade anchors! */
|
||||
if (channel->option_anchor_outputs)
|
||||
return type_anchor_outputs(ctx);
|
||||
return channel_type_anchor_outputs(ctx);
|
||||
|
||||
/* For now, we just want option_static_remotekey */
|
||||
return type_static_remotekey(ctx);
|
||||
return channel_type_static_remotekey(ctx);
|
||||
}
|
||||
#endif /* EXPERIMENTAL_FEATURES */
|
||||
|
||||
static char *fmt_channel_view(const tal_t *ctx, const struct channel_view *view)
|
||||
{
|
||||
|
||||
@@ -163,13 +163,12 @@ u32 channel_feerate(const struct channel *channel, enum side side);
|
||||
*/
|
||||
u32 channel_blockheight(const struct channel *channel, enum side side);
|
||||
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
/* BOLT-upgrade_protocol #2:
|
||||
* Channel features are explicitly enumerated as `channel_type` bitfields,
|
||||
* using odd features bits.
|
||||
*/
|
||||
struct channel_type *channel_type(const tal_t *ctx,
|
||||
const struct channel *channel);
|
||||
struct channel_type *current_channel_type(const tal_t *ctx,
|
||||
const struct channel *channel);
|
||||
|
||||
/* What features can we upgrade? (Returns NULL if none). */
|
||||
struct channel_type **channel_upgradable_types(const tal_t *ctx,
|
||||
@@ -178,6 +177,5 @@ struct channel_type **channel_upgradable_types(const tal_t *ctx,
|
||||
/* What features do we want? */
|
||||
struct channel_type *channel_desired_type(const tal_t *ctx,
|
||||
const struct channel *channel);
|
||||
#endif /* EXPERIMENTAL_FEATURES */
|
||||
|
||||
#endif /* LIGHTNING_COMMON_INITIAL_CHANNEL_H */
|
||||
|
||||
2
common/peer_status_wiregen.c
generated
2
common/peer_status_wiregen.c
generated
@@ -80,4 +80,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_
|
||||
fromwire_u8_array(&cursor, &plen, *error_for_them, len);
|
||||
return cursor != NULL;
|
||||
}
|
||||
// SHA256STAMP:53c75737dd0b8df4245093d3236d2d494451f01872e30b2ad76853766f22c60e
|
||||
// SHA256STAMP:b3244d3c5f959de2b906e7afc98c3278282ab06eab89c7572c424b36b994c484
|
||||
|
||||
2
common/peer_status_wiregen.h
generated
2
common/peer_status_wiregen.h
generated
@@ -34,4 +34,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_
|
||||
|
||||
|
||||
#endif /* LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H */
|
||||
// SHA256STAMP:53c75737dd0b8df4245093d3236d2d494451f01872e30b2ad76853766f22c60e
|
||||
// SHA256STAMP:b3244d3c5f959de2b906e7afc98c3278282ab06eab89c7572c424b36b994c484
|
||||
|
||||
2
common/status_wiregen.c
generated
2
common/status_wiregen.c
generated
@@ -214,4 +214,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi
|
||||
*version = fromwire_wirestring(ctx, &cursor, &plen);
|
||||
return cursor != NULL;
|
||||
}
|
||||
// SHA256STAMP:efb87b0bb9ae86931d808d17b03d3e7a9b4c4f2577f152f04fbe4531a6b8196a
|
||||
// SHA256STAMP:9ccc7c9a9c09390733ffde17bcee096fef4b4edbf469a5037574fe8eefe6f946
|
||||
|
||||
2
common/status_wiregen.h
generated
2
common/status_wiregen.h
generated
@@ -58,4 +58,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi
|
||||
|
||||
|
||||
#endif /* LIGHTNING_COMMON_STATUS_WIREGEN_H */
|
||||
// SHA256STAMP:efb87b0bb9ae86931d808d17b03d3e7a9b4c4f2577f152f04fbe4531a6b8196a
|
||||
// SHA256STAMP:9ccc7c9a9c09390733ffde17bcee096fef4b4edbf469a5037574fe8eefe6f946
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <ccan/tal/path/path.h>
|
||||
#include <common/bolt12.h>
|
||||
#include <common/setup.h>
|
||||
#include <wire/channel_type_wiregen.h>
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
@@ -25,6 +26,9 @@
|
||||
void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
@@ -50,6 +54,9 @@ void towire_bool(u8 **pptr UNNEEDED, bool v UNNEEDED)
|
||||
/* Generated stub for towire_channel_id */
|
||||
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <common/features.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdarg.h>
|
||||
#include <wire/channel_type_wiregen.h>
|
||||
|
||||
/* Definition of n1 from the spec */
|
||||
#include <wire/peer_wire.h>
|
||||
@@ -24,12 +25,18 @@ int features_unsupported(const struct feature_set *our_features UNNEEDED,
|
||||
void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_onionmsg_path */
|
||||
struct onionmsg_path *fromwire_onionmsg_path(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_onionmsg_path called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_id */
|
||||
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_onionmsg_path */
|
||||
void towire_onionmsg_path(u8 **p UNNEEDED, const struct onionmsg_path *onionmsg_path UNNEEDED)
|
||||
{ fprintf(stderr, "towire_onionmsg_path called!\n"); abort(); }
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <bitcoin/privkey.h>
|
||||
#include <ccan/read_write_all/read_write_all.h>
|
||||
#include <common/amount.h>
|
||||
#include <common/channel_type.h>
|
||||
#include <common/setup.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/tlvstream.h>
|
||||
@@ -19,12 +20,18 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_bigsize */
|
||||
void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
{ fprintf(stderr, "towire_bigsize called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_id */
|
||||
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for type_to_string_ */
|
||||
const char *type_to_string_(const tal_t *ctx UNNEEDED, const char *typename UNNEEDED,
|
||||
union printable_types u UNNEEDED)
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
#include <common/utils.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <wire/channel_type_wiregen.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
@@ -19,6 +23,9 @@ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
bool tlv_fields_valid(const struct tlv_field *fields UNNEEDED, u64 *allow_extra UNNEEDED,
|
||||
size_t *err_index UNNEEDED)
|
||||
{ fprintf(stderr, "tlv_fields_valid called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <wire/channel_type_wiregen.h>
|
||||
#include <wire/wire.h>
|
||||
|
||||
char *fail_msg = NULL;
|
||||
@@ -40,6 +41,9 @@ struct command_result *command_fail(struct command *cmd,
|
||||
}
|
||||
|
||||
/* AUTOGENERATED MOCKS START */
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
@@ -86,6 +90,9 @@ int segwit_addr_decode(
|
||||
bool tlv_fields_valid(const struct tlv_field *fields UNNEEDED, u64 *allow_extra UNNEEDED,
|
||||
size_t *err_index UNNEEDED)
|
||||
{ fprintf(stderr, "tlv_fields_valid called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* {'channels': [{'active': True, 'short_id': '6990x2x1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'last_update': 1504064344}, {'active': True, 'short_id': '6989x2x1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6990x2x1/0', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 0, 'destination': '02ea622d5c8d6143f15ed3ce1d501dd0d3d09d3b1c83a44d0034949f8a9ab60f06', 'source': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'last_update': 1504064344}, {'active': True, 'short_id': '6989x2x1/1', 'fee_per_kw': 10, 'delay': 5, 'message_flags': 0, 'channel_flags': 1, 'destination': '0230ad0e74ea03976b28fda587bb75bdd357a1938af4424156a18265167f5e40ae', 'source': '03c173897878996287a8100469f954dd820fcd8941daed91c327f168f3329be0bf', 'last_update': 1504064344}]}
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include <common/channel_type.h>
|
||||
#include <common/dijkstra.h>
|
||||
#include <common/gossmap.h>
|
||||
#include <common/gossip_store.h>
|
||||
@@ -24,6 +25,9 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
@@ -39,6 +43,9 @@ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
/* Generated stub for towire_channel_id */
|
||||
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <assert.h>
|
||||
#include <common/channel_type.h>
|
||||
#include <common/dijkstra.h>
|
||||
#include <common/gossmap.h>
|
||||
#include <common/gossip_store.h>
|
||||
@@ -17,6 +18,9 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
void fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channel_type */
|
||||
struct channel_type *fromwire_channel_type(const tal_t *ctx UNNEEDED, const u8 **cursor UNNEEDED, size_t *plen UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_tlv */
|
||||
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
@@ -32,6 +36,9 @@ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
/* Generated stub for towire_channel_id */
|
||||
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_channel_type */
|
||||
void towire_channel_type(u8 **p UNNEEDED, const struct channel_type *channel_type UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_type called!\n"); abort(); }
|
||||
/* Generated stub for towire_tlv */
|
||||
void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
|
||||
Reference in New Issue
Block a user