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:
Rusty Russell
2021-09-09 12:20:52 +09:30
committed by Christian Decker
parent 1b8551923d
commit cb22015b2a
74 changed files with 404 additions and 122 deletions

View File

@@ -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,