diff --git a/INSTALL.md b/INSTALL.md index 0ab85b23c..6f71bcedd 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,8 +2,6 @@ Library Requirements -------------------- You will need several development libraries: -* libprotoc: the Google protocol buffer v2 library, 2.6.0 or above. -* protobuf-c: version 1.1.0 or above. * libsqlite3: for database support. * libgmp: for secp256k1 @@ -15,12 +13,12 @@ For actually doing development and running the tests, you will also need: You will also need a version of bitcoind with segregated witness support, such as the 0.13 or above. -To Build on Ubuntu 16.04 +To Build on Ubuntu 15.10 or above --------------------- Get dependencies: ``` -sudo apt-get install -y autoconf build-essential git libtool libprotobuf-c-dev libgmp-dev libsqlite3-dev python3 net-tools +sudo apt-get install -y autoconf build-essential git libtool libgmp-dev libsqlite3-dev python3 net-tools ``` If you don't have Bitcoin installed locally you'll need to install that as well: @@ -56,35 +54,3 @@ bitcoind & ``` **Note**: You may need to include `testnet=1` in `bitcoin.conf` -To Build on Ubuntu 15.10 ------------------------- -Build protobuf-c dependency (>= 1.1.0): -``` -sudo apt-get install libprotoc-dev -git clone https://github.com/protobuf-c/protobuf-c.git -cd protobuf-c -./autogen.sh -./configure -make -make install -cd ../ -``` - -Clone lightning: -``` -git clone https://github.com/ElementsProject/lightning.git -cd lighting -``` - -Build lightning: -``` -make -``` - -Running lightning: -``` -bitcoind -export LD_LIBRARY_PATH=/usr/local/lib -./lightningd/lightningd -./daemon/lightning-cli help -``` diff --git a/Makefile b/Makefile index ba5d4564c..6c941c659 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,6 @@ #! /usr/bin/make NAME=Bitcoin Savings & Trust Daily Interest II -# Needs to have oneof support: Ubuntu vivid's is too old :( -PROTOCC:=protoc-c - # We use our own internal ccan copy. CCANDIR := ccan @@ -60,12 +57,6 @@ CORE_TX_SRC := \ CORE_TX_OBJS := $(CORE_TX_SRC:.c=.o) -CORE_PROTOBUF_SRC := \ - lightning.pb-c.c \ - protobuf_convert.c - -CORE_PROTOBUF_OBJS := $(CORE_PROTOBUF_SRC:.c=.o) - CCAN_OBJS := \ ccan-asort.o \ ccan-autodata.o \ @@ -189,13 +180,11 @@ CORE_TX_HEADERS := close_tx.h \ CORE_HEADERS := \ opt_bits.h \ overflows.h \ - protobuf_convert.h \ type_to_string.h \ utils.h \ version.h -GEN_HEADERS := gen_version.h \ - lightning.pb-c.h +GEN_HEADERS := gen_version.h LIBSODIUM_HEADERS := libsodium/src/libsodium/include/sodium.h LIBWALLY_HEADERS := libwally-core/include/wally_bip32.h \ @@ -214,7 +203,7 @@ CWARNFLAGS := -Werror -Wall -Wundef -Wmissing-prototypes -Wmissing-declarations CDEBUGFLAGS := -std=gnu11 -g -fstack-protector CFLAGS := $(CWARNFLAGS) $(CDEBUGFLAGS) -I $(CCANDIR) -I libwally-core/src/secp256k1/include/ -I libwally-core/include/ -I libsodium/src/libsodium/include/ -I . $(FEATURES) $(COVFLAGS) -DSHACHAIN_BITS=48 -LDLIBS := -lprotobuf-c -lgmp -lsqlite3 $(COVFLAGS) +LDLIBS := -lgmp -lsqlite3 $(COVFLAGS) $(PROGRAMS): CFLAGS+=-I. default: $(PROGRAMS) doc-all @@ -232,7 +221,7 @@ CHANGED_FROM_GIT = [ x"`git log $@ | head -n1`" != x"`git log $< | head -n1`" -o $(CCAN_OBJS) $(CCAN_SHACHAIN48_OBJ) $(CDUMP_OBJS) $(HELPER_OBJS) $(BITCOIN_OBJS) $(TEST_PROGRAMS:=.o) ccan/ccan/cdump/tools/cdump-enumstr.o: $(CCAN_HEADERS) # Except for CCAN, everything depends on bitcoin/ and core headers. -$(HELPER_OBJS) $(CORE_OBJS) $(CORE_TX_OBJS) $(CORE_PROTOBUF_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(WALLET_LIB_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) $(LIBBASE58_HEADERS) $(LIBSODIUM_HEADERS) $(LIBWALLY_HEADERS) +$(HELPER_OBJS) $(CORE_OBJS) $(CORE_TX_OBJS) $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(WALLET_LIB_OBJS) $(TEST_PROGRAMS:=.o): $(BITCOIN_HEADERS) $(CORE_HEADERS) $(CCAN_HEADERS) $(GEN_HEADERS) $(LIBBASE58_HEADERS) $(LIBSODIUM_HEADERS) $(LIBWALLY_HEADERS) test-protocol: test/test_protocol set -e; TMP=`mktemp`; for f in test/commits/*.script; do if ! $(VALGRIND) test/test_protocol < $$f > $$TMP; then echo "test/test_protocol < $$f FAILED" >&2; exit 1; fi; diff -u $$TMP $$f.expected; done; rm $$TMP @@ -255,7 +244,7 @@ check-hdr-include-order/%: % # Make sure Makefile includes all headers. check-makefile: @if [ "`echo bitcoin/*.h`" != "$(BITCOIN_HEADERS)" ]; then echo BITCOIN_HEADERS incorrect; exit 1; fi - @if [ x"`ls *.h | grep -v ^gen_ | fgrep -v lightning.pb-c.h`" != x"`echo $(CORE_HEADERS) $(CORE_TX_HEADERS) | tr ' ' '\n' | LC_ALL=C sort`" ]; then echo CORE_HEADERS incorrect; exit 1; fi + @if [ x"`ls *.h | grep -v ^gen_`" != x"`echo $(CORE_HEADERS) $(CORE_TX_HEADERS) | tr ' ' '\n' | LC_ALL=C sort`" ]; then echo CORE_HEADERS incorrect; exit 1; fi @if [ x"$(CCANDIR)/config.h `find $(CCANDIR)/ccan -name '*.h' | grep -v /test/ | LC_ALL=C sort | tr '\n' ' '`" != x"$(CCAN_HEADERS) " ]; then echo CCAN_HEADERS incorrect; exit 1; fi # Any mention of BOLT# must be followed by an exact quote, modulo whitepace. @@ -265,7 +254,7 @@ bolt-check/%: % bolt-precheck tools/check-bolt bolt-precheck: @rm -rf .tmp.lightningrfc; if [ ! -d $(BOLTDIR) ]; then echo Not checking BOLT references: BOLTDIR $(BOLTDIR) does not exist >&2; exit 0; fi; set -e; if [ -n "$(BOLTVERSION)" ]; then git clone -q -b $(BOLTVERSION) $(BOLTDIR) .tmp.lightningrfc; else cp -a $(BOLTDIR) .tmp.lightningrfc; fi -check-source-bolt: $(CORE_SRC:%=bolt-check/%) $(CORE_TX_SRC:%=bolt-check/%) $(CORE_PROTOBUF_SRC:%=bolt-check/%) $(CORE_HEADERS:%=bolt-check/%) $(TEST_PROGRAMS:%=bolt-check/%.c) +check-source-bolt: $(CORE_SRC:%=bolt-check/%) $(CORE_TX_SRC:%=bolt-check/%) $(CORE_HEADERS:%=bolt-check/%) $(TEST_PROGRAMS:%=bolt-check/%.c) tools/check-bolt: tools/check-bolt.o $(CCAN_OBJS) @@ -274,12 +263,11 @@ tools/check-bolt.o: $(CCAN_HEADERS) check-whitespace/%: % @if grep -Hn '[ ]$$' $<; then echo Extraneous whitespace found >&2; exit 1; fi -check-whitespace: check-whitespace/Makefile check-whitespace/tools/check-bolt.c $(CORE_SRC:%=check-whitespace/%) $(CORE_TX_SRC:%=check-whitespace/%) $(CORE_PROTOBUF_SRC:%=check-whitespace/%) $(CORE_HEADERS:%=check-whitespace/%) +check-whitespace: check-whitespace/Makefile check-whitespace/tools/check-bolt.c $(CORE_SRC:%=check-whitespace/%) $(CORE_TX_SRC:%=check-whitespace/%) $(CORE_HEADERS:%=check-whitespace/%) check-source: check-makefile check-source-bolt check-whitespace \ $(CORE_SRC:%=check-src-include-order/%) \ $(CORE_TX_SRC:%=check-src-include-order/%) \ - $(CORE_PROTOBUF_SRC:%=check-src-include-order/%) \ $(BITCOIN_SRC:%=check-src-include-order/%) \ $(CORE_HEADERS:%=check-hdr-include-order/%) \ $(CORE_TX_HEADERS:%=check-hdr-include-order/%) \ @@ -320,9 +308,6 @@ libsecp256k1.% libwallycore.%: libwally-core/src/secp256k1/libsecp256k1.la libwa libwally-core/src/libwallycore.% libwally-core/src/secp256k1/libsecp256k1.%: $(LIBWALLY_HEADERS) $(LIBSECP_HEADERS) cd libwally-core && ./tools/autogen.sh && ./configure CC="$(CC)" --enable-static=yes --enable-shared=no --libdir=`pwd`/.. && $(MAKE) -lightning.pb-c.c lightning.pb-c.h: lightning.proto - @if $(CHANGED_FROM_GIT); then echo $(PROTOCC) lightning.proto --c_out=.; $(PROTOCC) lightning.proto --c_out=.; else touch $@; fi - $(TEST_PROGRAMS): % : %.o $(BITCOIN_OBJS) $(LIBBASE58_OBJS) $(WIRE_OBJS) $(CCAN_OBJS) lightningd/sphinx.o utils.o version.o libwallycore.a libsecp256k1.a libsodium.a ccan/config.h: ccan/tools/configurator/configurator @@ -363,7 +348,6 @@ distclean: clean maintainer-clean: distclean @echo 'This command is intended for maintainers to use; it' @echo 'deletes files that may need special tools to rebuild.' - $(RM) lightning.pb-c.c lightning.pb-c.h clean: daemon-clean wire-clean $(MAKE) -C secp256k1/ clean || true diff --git a/README.md b/README.md index 881c77d53..627d470bf 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Please refer to the [installation documentation](INSTALL.md) for detailed instru For the impatient here's the gist of it for Ubuntu and Debian: ``` -sudo apt-get install -y autoconf git build-essential libtool libprotobuf-c-dev libgmp-dev libsqlite3-dev python python3 +sudo apt-get install -y autoconf git build-essential libtool libgmp-dev libsqlite3-dev python python3 git clone https://github.com/ElementsProject/lightning.git cd lightning make diff --git a/close_tx.c b/close_tx.c index c5b9b8883..017540b97 100644 --- a/close_tx.c +++ b/close_tx.c @@ -2,7 +2,7 @@ #include "bitcoin/tx.h" #include "close_tx.h" #include "permute_tx.h" -#include "protobuf_convert.h" +#include struct bitcoin_tx *create_close_tx(const tal_t *ctx, const u8 *our_script, diff --git a/close_tx.h b/close_tx.h index 013534c0f..f2051ff5b 100644 --- a/close_tx.h +++ b/close_tx.h @@ -1,7 +1,6 @@ #ifndef LIGHTNING_CLOSE_TX_H #define LIGHTNING_CLOSE_TX_H #include "config.h" -#include "lightning.pb-c.h" #include #include diff --git a/daemon/Makefile b/daemon/Makefile index 688549a45..97500ca55 100644 --- a/daemon/Makefile +++ b/daemon/Makefile @@ -59,7 +59,6 @@ DAEMON_HEADERS := \ daemon/netaddr.h \ daemon/opt_time.h \ daemon/options.h \ - daemon/packets.h \ daemon/pseudorand.h \ daemon/routing.h \ daemon/timeout.h \ diff --git a/daemon/packets.h b/daemon/packets.h deleted file mode 100644 index 04f8746c7..000000000 --- a/daemon/packets.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef LIGHTNING_DAEMON_PACKETS_H -#define LIGHTNING_DAEMON_PACKETS_H -#include "config.h" -#include "lightning.pb-c.h" - -struct commit_info; -struct htlc; -struct peer; -struct preimage; -struct sha256; - -/* Send various kinds of packets */ -void queue_pkt_open(struct peer *peer, bool offer_anchor); -void queue_pkt_anchor(struct peer *peer); -void queue_pkt_open_commit_sig(struct peer *peer); -void queue_pkt_open_complete(struct peer *peer); -void queue_pkt_htlc_add(struct peer *peer, struct htlc *htlc); -void queue_pkt_htlc_fulfill(struct peer *peer, struct htlc *htlc); -void queue_pkt_htlc_fail(struct peer *peer, struct htlc *htlc); -void queue_pkt_feechange(struct peer *peer, u64 feerate); -void queue_pkt_commit(struct peer *peer, const secp256k1_ecdsa_signature *sig); -void queue_pkt_revocation(struct peer *peer, - const struct sha256 *preimage, - const struct sha256 *next_hash); -void queue_pkt_close_shutdown(struct peer *peer); -void queue_pkt_close_signature(struct peer *peer); -void queue_pkt_nested(struct peer *peer, int type, const u8 *nested_pkt); - -Pkt *pkt_err(struct peer *peer, const char *msg, ...); -Pkt *pkt_init(struct peer *peer, u64 ack); -void queue_pkt_err(struct peer *peer, Pkt *err); -Pkt *pkt_err_unexpected(struct peer *peer, const Pkt *pkt); - -/* Process various packets: return an error packet on failure. */ -Pkt *accept_pkt_open(struct peer *peer, const Pkt *pkt, - struct sha256 *revocation_hash, - struct sha256 *next_revocation_hash); - -Pkt *accept_pkt_anchor(struct peer *peer, const Pkt *pkt); - -Pkt *accept_pkt_open_commit_sig(struct peer *peer, const Pkt *pkt, - secp256k1_ecdsa_signature *sig); - -Pkt *accept_pkt_open_complete(struct peer *peer, const Pkt *pkt); - -Pkt *accept_pkt_htlc_add(struct peer *peer, const Pkt *pkt, struct htlc **h); - -Pkt *accept_pkt_htlc_fail(struct peer *peer, const Pkt *pkt, struct htlc **h, - u8 **fail); - -Pkt *accept_pkt_htlc_fulfill(struct peer *peer, const Pkt *pkt, struct htlc **h, - struct preimage *r); - -Pkt *accept_pkt_update_fee(struct peer *peer, const Pkt *pkt, u64 *feerate); - -Pkt *accept_pkt_update_accept(struct peer *peer, const Pkt *pkt); - -Pkt *accept_pkt_commit(struct peer *peer, const Pkt *pkt, - secp256k1_ecdsa_signature *sig); - -Pkt *accept_pkt_revocation(struct peer *peer, const Pkt *pkt); - -Pkt *accept_pkt_close_shutdown(struct peer *peer, const Pkt *pkt); - -#endif /* LIGHTNING_DAEMON_PACKETS_H */ diff --git a/daemon/routing.c b/daemon/routing.c index 70b41901a..ffd4ff0e9 100644 --- a/daemon/routing.c +++ b/daemon/routing.c @@ -1,7 +1,6 @@ #include "lightningd.h" #include "log.h" #include "overflows.h" -#include "packets.h" #include "pseudorand.h" #include "routing.h" #include "wire/gen_peer_wire.h" diff --git a/lightning.pb-c.c b/lightning.pb-c.c deleted file mode 100644 index ddbe53c37..000000000 --- a/lightning.pb-c.c +++ /dev/null @@ -1,3016 +0,0 @@ -/* Generated by the protocol buffer compiler. DO NOT EDIT! */ -/* Generated from: lightning.proto */ - -/* Do not generate deprecated warnings for self */ -#ifndef PROTOBUF_C__NO_DEPRECATED -#define PROTOBUF_C__NO_DEPRECATED -#endif - -#include "lightning.pb-c.h" -void sha256_hash__init - (Sha256Hash *message) -{ - static Sha256Hash init_value = SHA256_HASH__INIT; - *message = init_value; -} -size_t sha256_hash__get_packed_size - (const Sha256Hash *message) -{ - assert(message->base.descriptor == &sha256_hash__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t sha256_hash__pack - (const Sha256Hash *message, - uint8_t *out) -{ - assert(message->base.descriptor == &sha256_hash__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t sha256_hash__pack_to_buffer - (const Sha256Hash *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &sha256_hash__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Sha256Hash * - sha256_hash__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Sha256Hash *) - protobuf_c_message_unpack (&sha256_hash__descriptor, - allocator, len, data); -} -void sha256_hash__free_unpacked - (Sha256Hash *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &sha256_hash__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void preimage__init - (Preimage *message) -{ - static Preimage init_value = PREIMAGE__INIT; - *message = init_value; -} -size_t preimage__get_packed_size - (const Preimage *message) -{ - assert(message->base.descriptor == &preimage__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t preimage__pack - (const Preimage *message, - uint8_t *out) -{ - assert(message->base.descriptor == &preimage__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t preimage__pack_to_buffer - (const Preimage *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &preimage__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Preimage * - preimage__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Preimage *) - protobuf_c_message_unpack (&preimage__descriptor, - allocator, len, data); -} -void preimage__free_unpacked - (Preimage *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &preimage__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void signature__init - (Signature *message) -{ - static Signature init_value = SIGNATURE__INIT; - *message = init_value; -} -size_t signature__get_packed_size - (const Signature *message) -{ - assert(message->base.descriptor == &signature__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t signature__pack - (const Signature *message, - uint8_t *out) -{ - assert(message->base.descriptor == &signature__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t signature__pack_to_buffer - (const Signature *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &signature__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Signature * - signature__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Signature *) - protobuf_c_message_unpack (&signature__descriptor, - allocator, len, data); -} -void signature__free_unpacked - (Signature *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &signature__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void locktime__init - (Locktime *message) -{ - static Locktime init_value = LOCKTIME__INIT; - *message = init_value; -} -size_t locktime__get_packed_size - (const Locktime *message) -{ - assert(message->base.descriptor == &locktime__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t locktime__pack - (const Locktime *message, - uint8_t *out) -{ - assert(message->base.descriptor == &locktime__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t locktime__pack_to_buffer - (const Locktime *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &locktime__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Locktime * - locktime__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Locktime *) - protobuf_c_message_unpack (&locktime__descriptor, - allocator, len, data); -} -void locktime__free_unpacked - (Locktime *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &locktime__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void bitcoin_pubkey__init - (BitcoinPubkey *message) -{ - static BitcoinPubkey init_value = BITCOIN_PUBKEY__INIT; - *message = init_value; -} -size_t bitcoin_pubkey__get_packed_size - (const BitcoinPubkey *message) -{ - assert(message->base.descriptor == &bitcoin_pubkey__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t bitcoin_pubkey__pack - (const BitcoinPubkey *message, - uint8_t *out) -{ - assert(message->base.descriptor == &bitcoin_pubkey__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t bitcoin_pubkey__pack_to_buffer - (const BitcoinPubkey *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &bitcoin_pubkey__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -BitcoinPubkey * - bitcoin_pubkey__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (BitcoinPubkey *) - protobuf_c_message_unpack (&bitcoin_pubkey__descriptor, - allocator, len, data); -} -void bitcoin_pubkey__free_unpacked - (BitcoinPubkey *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &bitcoin_pubkey__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void funding__init - (Funding *message) -{ - static Funding init_value = FUNDING__INIT; - *message = init_value; -} -size_t funding__get_packed_size - (const Funding *message) -{ - assert(message->base.descriptor == &funding__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t funding__pack - (const Funding *message, - uint8_t *out) -{ - assert(message->base.descriptor == &funding__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t funding__pack_to_buffer - (const Funding *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &funding__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Funding * - funding__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Funding *) - protobuf_c_message_unpack (&funding__descriptor, - allocator, len, data); -} -void funding__free_unpacked - (Funding *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &funding__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void authenticate__init - (Authenticate *message) -{ - static Authenticate init_value = AUTHENTICATE__INIT; - *message = init_value; -} -size_t authenticate__get_packed_size - (const Authenticate *message) -{ - assert(message->base.descriptor == &authenticate__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t authenticate__pack - (const Authenticate *message, - uint8_t *out) -{ - assert(message->base.descriptor == &authenticate__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t authenticate__pack_to_buffer - (const Authenticate *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &authenticate__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Authenticate * - authenticate__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Authenticate *) - protobuf_c_message_unpack (&authenticate__descriptor, - allocator, len, data); -} -void authenticate__free_unpacked - (Authenticate *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &authenticate__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void init__init - (Init *message) -{ - static Init init_value = INIT__INIT; - *message = init_value; -} -size_t init__get_packed_size - (const Init *message) -{ - assert(message->base.descriptor == &init__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t init__pack - (const Init *message, - uint8_t *out) -{ - assert(message->base.descriptor == &init__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t init__pack_to_buffer - (const Init *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &init__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Init * - init__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Init *) - protobuf_c_message_unpack (&init__descriptor, - allocator, len, data); -} -void init__free_unpacked - (Init *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &init__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void open_channel__init - (OpenChannel *message) -{ - static OpenChannel init_value = OPEN_CHANNEL__INIT; - *message = init_value; -} -size_t open_channel__get_packed_size - (const OpenChannel *message) -{ - assert(message->base.descriptor == &open_channel__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t open_channel__pack - (const OpenChannel *message, - uint8_t *out) -{ - assert(message->base.descriptor == &open_channel__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t open_channel__pack_to_buffer - (const OpenChannel *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &open_channel__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -OpenChannel * - open_channel__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (OpenChannel *) - protobuf_c_message_unpack (&open_channel__descriptor, - allocator, len, data); -} -void open_channel__free_unpacked - (OpenChannel *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &open_channel__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void open_anchor__init - (OpenAnchor *message) -{ - static OpenAnchor init_value = OPEN_ANCHOR__INIT; - *message = init_value; -} -size_t open_anchor__get_packed_size - (const OpenAnchor *message) -{ - assert(message->base.descriptor == &open_anchor__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t open_anchor__pack - (const OpenAnchor *message, - uint8_t *out) -{ - assert(message->base.descriptor == &open_anchor__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t open_anchor__pack_to_buffer - (const OpenAnchor *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &open_anchor__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -OpenAnchor * - open_anchor__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (OpenAnchor *) - protobuf_c_message_unpack (&open_anchor__descriptor, - allocator, len, data); -} -void open_anchor__free_unpacked - (OpenAnchor *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &open_anchor__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void open_commit_sig__init - (OpenCommitSig *message) -{ - static OpenCommitSig init_value = OPEN_COMMIT_SIG__INIT; - *message = init_value; -} -size_t open_commit_sig__get_packed_size - (const OpenCommitSig *message) -{ - assert(message->base.descriptor == &open_commit_sig__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t open_commit_sig__pack - (const OpenCommitSig *message, - uint8_t *out) -{ - assert(message->base.descriptor == &open_commit_sig__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t open_commit_sig__pack_to_buffer - (const OpenCommitSig *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &open_commit_sig__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -OpenCommitSig * - open_commit_sig__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (OpenCommitSig *) - protobuf_c_message_unpack (&open_commit_sig__descriptor, - allocator, len, data); -} -void open_commit_sig__free_unpacked - (OpenCommitSig *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &open_commit_sig__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void open_complete__init - (OpenComplete *message) -{ - static OpenComplete init_value = OPEN_COMPLETE__INIT; - *message = init_value; -} -size_t open_complete__get_packed_size - (const OpenComplete *message) -{ - assert(message->base.descriptor == &open_complete__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t open_complete__pack - (const OpenComplete *message, - uint8_t *out) -{ - assert(message->base.descriptor == &open_complete__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t open_complete__pack_to_buffer - (const OpenComplete *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &open_complete__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -OpenComplete * - open_complete__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (OpenComplete *) - protobuf_c_message_unpack (&open_complete__descriptor, - allocator, len, data); -} -void open_complete__free_unpacked - (OpenComplete *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &open_complete__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void route_step__init - (RouteStep *message) -{ - static RouteStep init_value = ROUTE_STEP__INIT; - *message = init_value; -} -size_t route_step__get_packed_size - (const RouteStep *message) -{ - assert(message->base.descriptor == &route_step__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t route_step__pack - (const RouteStep *message, - uint8_t *out) -{ - assert(message->base.descriptor == &route_step__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t route_step__pack_to_buffer - (const RouteStep *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &route_step__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -RouteStep * - route_step__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (RouteStep *) - protobuf_c_message_unpack (&route_step__descriptor, - allocator, len, data); -} -void route_step__free_unpacked - (RouteStep *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &route_step__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void route__init - (Route *message) -{ - static Route init_value = ROUTE__INIT; - *message = init_value; -} -size_t route__get_packed_size - (const Route *message) -{ - assert(message->base.descriptor == &route__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t route__pack - (const Route *message, - uint8_t *out) -{ - assert(message->base.descriptor == &route__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t route__pack_to_buffer - (const Route *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &route__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Route * - route__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Route *) - protobuf_c_message_unpack (&route__descriptor, - allocator, len, data); -} -void route__free_unpacked - (Route *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &route__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void routing__init - (Routing *message) -{ - static Routing init_value = ROUTING__INIT; - *message = init_value; -} -size_t routing__get_packed_size - (const Routing *message) -{ - assert(message->base.descriptor == &routing__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t routing__pack - (const Routing *message, - uint8_t *out) -{ - assert(message->base.descriptor == &routing__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t routing__pack_to_buffer - (const Routing *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &routing__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Routing * - routing__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Routing *) - protobuf_c_message_unpack (&routing__descriptor, - allocator, len, data); -} -void routing__free_unpacked - (Routing *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &routing__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void update_add_htlc__init - (UpdateAddHtlc *message) -{ - static UpdateAddHtlc init_value = UPDATE_ADD_HTLC__INIT; - *message = init_value; -} -size_t update_add_htlc__get_packed_size - (const UpdateAddHtlc *message) -{ - assert(message->base.descriptor == &update_add_htlc__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t update_add_htlc__pack - (const UpdateAddHtlc *message, - uint8_t *out) -{ - assert(message->base.descriptor == &update_add_htlc__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t update_add_htlc__pack_to_buffer - (const UpdateAddHtlc *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &update_add_htlc__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -UpdateAddHtlc * - update_add_htlc__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (UpdateAddHtlc *) - protobuf_c_message_unpack (&update_add_htlc__descriptor, - allocator, len, data); -} -void update_add_htlc__free_unpacked - (UpdateAddHtlc *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &update_add_htlc__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void update_fulfill_htlc__init - (UpdateFulfillHtlc *message) -{ - static UpdateFulfillHtlc init_value = UPDATE_FULFILL_HTLC__INIT; - *message = init_value; -} -size_t update_fulfill_htlc__get_packed_size - (const UpdateFulfillHtlc *message) -{ - assert(message->base.descriptor == &update_fulfill_htlc__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t update_fulfill_htlc__pack - (const UpdateFulfillHtlc *message, - uint8_t *out) -{ - assert(message->base.descriptor == &update_fulfill_htlc__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t update_fulfill_htlc__pack_to_buffer - (const UpdateFulfillHtlc *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &update_fulfill_htlc__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -UpdateFulfillHtlc * - update_fulfill_htlc__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (UpdateFulfillHtlc *) - protobuf_c_message_unpack (&update_fulfill_htlc__descriptor, - allocator, len, data); -} -void update_fulfill_htlc__free_unpacked - (UpdateFulfillHtlc *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &update_fulfill_htlc__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void fail_info__init - (FailInfo *message) -{ - static FailInfo init_value = FAIL_INFO__INIT; - *message = init_value; -} -size_t fail_info__get_packed_size - (const FailInfo *message) -{ - assert(message->base.descriptor == &fail_info__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t fail_info__pack - (const FailInfo *message, - uint8_t *out) -{ - assert(message->base.descriptor == &fail_info__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t fail_info__pack_to_buffer - (const FailInfo *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &fail_info__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -FailInfo * - fail_info__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (FailInfo *) - protobuf_c_message_unpack (&fail_info__descriptor, - allocator, len, data); -} -void fail_info__free_unpacked - (FailInfo *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &fail_info__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void fail_reason__init - (FailReason *message) -{ - static FailReason init_value = FAIL_REASON__INIT; - *message = init_value; -} -size_t fail_reason__get_packed_size - (const FailReason *message) -{ - assert(message->base.descriptor == &fail_reason__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t fail_reason__pack - (const FailReason *message, - uint8_t *out) -{ - assert(message->base.descriptor == &fail_reason__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t fail_reason__pack_to_buffer - (const FailReason *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &fail_reason__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -FailReason * - fail_reason__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (FailReason *) - protobuf_c_message_unpack (&fail_reason__descriptor, - allocator, len, data); -} -void fail_reason__free_unpacked - (FailReason *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &fail_reason__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void update_fail_htlc__init - (UpdateFailHtlc *message) -{ - static UpdateFailHtlc init_value = UPDATE_FAIL_HTLC__INIT; - *message = init_value; -} -size_t update_fail_htlc__get_packed_size - (const UpdateFailHtlc *message) -{ - assert(message->base.descriptor == &update_fail_htlc__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t update_fail_htlc__pack - (const UpdateFailHtlc *message, - uint8_t *out) -{ - assert(message->base.descriptor == &update_fail_htlc__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t update_fail_htlc__pack_to_buffer - (const UpdateFailHtlc *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &update_fail_htlc__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -UpdateFailHtlc * - update_fail_htlc__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (UpdateFailHtlc *) - protobuf_c_message_unpack (&update_fail_htlc__descriptor, - allocator, len, data); -} -void update_fail_htlc__free_unpacked - (UpdateFailHtlc *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &update_fail_htlc__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void update_fee__init - (UpdateFee *message) -{ - static UpdateFee init_value = UPDATE_FEE__INIT; - *message = init_value; -} -size_t update_fee__get_packed_size - (const UpdateFee *message) -{ - assert(message->base.descriptor == &update_fee__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t update_fee__pack - (const UpdateFee *message, - uint8_t *out) -{ - assert(message->base.descriptor == &update_fee__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t update_fee__pack_to_buffer - (const UpdateFee *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &update_fee__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -UpdateFee * - update_fee__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (UpdateFee *) - protobuf_c_message_unpack (&update_fee__descriptor, - allocator, len, data); -} -void update_fee__free_unpacked - (UpdateFee *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &update_fee__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void update_commit__init - (UpdateCommit *message) -{ - static UpdateCommit init_value = UPDATE_COMMIT__INIT; - *message = init_value; -} -size_t update_commit__get_packed_size - (const UpdateCommit *message) -{ - assert(message->base.descriptor == &update_commit__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t update_commit__pack - (const UpdateCommit *message, - uint8_t *out) -{ - assert(message->base.descriptor == &update_commit__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t update_commit__pack_to_buffer - (const UpdateCommit *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &update_commit__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -UpdateCommit * - update_commit__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (UpdateCommit *) - protobuf_c_message_unpack (&update_commit__descriptor, - allocator, len, data); -} -void update_commit__free_unpacked - (UpdateCommit *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &update_commit__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void update_revocation__init - (UpdateRevocation *message) -{ - static UpdateRevocation init_value = UPDATE_REVOCATION__INIT; - *message = init_value; -} -size_t update_revocation__get_packed_size - (const UpdateRevocation *message) -{ - assert(message->base.descriptor == &update_revocation__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t update_revocation__pack - (const UpdateRevocation *message, - uint8_t *out) -{ - assert(message->base.descriptor == &update_revocation__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t update_revocation__pack_to_buffer - (const UpdateRevocation *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &update_revocation__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -UpdateRevocation * - update_revocation__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (UpdateRevocation *) - protobuf_c_message_unpack (&update_revocation__descriptor, - allocator, len, data); -} -void update_revocation__free_unpacked - (UpdateRevocation *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &update_revocation__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void close_shutdown__init - (CloseShutdown *message) -{ - static CloseShutdown init_value = CLOSE_SHUTDOWN__INIT; - *message = init_value; -} -size_t close_shutdown__get_packed_size - (const CloseShutdown *message) -{ - assert(message->base.descriptor == &close_shutdown__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t close_shutdown__pack - (const CloseShutdown *message, - uint8_t *out) -{ - assert(message->base.descriptor == &close_shutdown__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t close_shutdown__pack_to_buffer - (const CloseShutdown *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &close_shutdown__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -CloseShutdown * - close_shutdown__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (CloseShutdown *) - protobuf_c_message_unpack (&close_shutdown__descriptor, - allocator, len, data); -} -void close_shutdown__free_unpacked - (CloseShutdown *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &close_shutdown__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void close_signature__init - (CloseSignature *message) -{ - static CloseSignature init_value = CLOSE_SIGNATURE__INIT; - *message = init_value; -} -size_t close_signature__get_packed_size - (const CloseSignature *message) -{ - assert(message->base.descriptor == &close_signature__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t close_signature__pack - (const CloseSignature *message, - uint8_t *out) -{ - assert(message->base.descriptor == &close_signature__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t close_signature__pack_to_buffer - (const CloseSignature *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &close_signature__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -CloseSignature * - close_signature__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (CloseSignature *) - protobuf_c_message_unpack (&close_signature__descriptor, - allocator, len, data); -} -void close_signature__free_unpacked - (CloseSignature *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &close_signature__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void error__init - (Error *message) -{ - static Error init_value = ERROR__INIT; - *message = init_value; -} -size_t error__get_packed_size - (const Error *message) -{ - assert(message->base.descriptor == &error__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t error__pack - (const Error *message, - uint8_t *out) -{ - assert(message->base.descriptor == &error__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t error__pack_to_buffer - (const Error *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &error__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Error * - error__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Error *) - protobuf_c_message_unpack (&error__descriptor, - allocator, len, data); -} -void error__free_unpacked - (Error *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &error__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void nested_pkt__init - (NestedPkt *message) -{ - static NestedPkt init_value = NESTED_PKT__INIT; - *message = init_value; -} -size_t nested_pkt__get_packed_size - (const NestedPkt *message) -{ - assert(message->base.descriptor == &nested_pkt__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t nested_pkt__pack - (const NestedPkt *message, - uint8_t *out) -{ - assert(message->base.descriptor == &nested_pkt__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t nested_pkt__pack_to_buffer - (const NestedPkt *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &nested_pkt__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -NestedPkt * - nested_pkt__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (NestedPkt *) - protobuf_c_message_unpack (&nested_pkt__descriptor, - allocator, len, data); -} -void nested_pkt__free_unpacked - (NestedPkt *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &nested_pkt__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -void pkt__init - (Pkt *message) -{ - static Pkt init_value = PKT__INIT; - *message = init_value; -} -size_t pkt__get_packed_size - (const Pkt *message) -{ - assert(message->base.descriptor == &pkt__descriptor); - return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); -} -size_t pkt__pack - (const Pkt *message, - uint8_t *out) -{ - assert(message->base.descriptor == &pkt__descriptor); - return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); -} -size_t pkt__pack_to_buffer - (const Pkt *message, - ProtobufCBuffer *buffer) -{ - assert(message->base.descriptor == &pkt__descriptor); - return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); -} -Pkt * - pkt__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data) -{ - return (Pkt *) - protobuf_c_message_unpack (&pkt__descriptor, - allocator, len, data); -} -void pkt__free_unpacked - (Pkt *message, - ProtobufCAllocator *allocator) -{ - assert(message->base.descriptor == &pkt__descriptor); - protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); -} -static const ProtobufCFieldDescriptor sha256_hash__field_descriptors[4] = -{ - { - "a", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Sha256Hash, a), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "b", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Sha256Hash, b), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "c", - 3, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Sha256Hash, c), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "d", - 4, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Sha256Hash, d), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned sha256_hash__field_indices_by_name[] = { - 0, /* field[0] = a */ - 1, /* field[1] = b */ - 2, /* field[2] = c */ - 3, /* field[3] = d */ -}; -static const ProtobufCIntRange sha256_hash__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 4 } -}; -const ProtobufCMessageDescriptor sha256_hash__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "sha256_hash", - "Sha256Hash", - "Sha256Hash", - "", - sizeof(Sha256Hash), - 4, - sha256_hash__field_descriptors, - sha256_hash__field_indices_by_name, - 1, sha256_hash__number_ranges, - (ProtobufCMessageInit) sha256_hash__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor preimage__field_descriptors[4] = -{ - { - "a", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Preimage, a), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "b", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Preimage, b), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "c", - 3, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Preimage, c), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "d", - 4, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Preimage, d), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned preimage__field_indices_by_name[] = { - 0, /* field[0] = a */ - 1, /* field[1] = b */ - 2, /* field[2] = c */ - 3, /* field[3] = d */ -}; -static const ProtobufCIntRange preimage__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 4 } -}; -const ProtobufCMessageDescriptor preimage__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "preimage", - "Preimage", - "Preimage", - "", - sizeof(Preimage), - 4, - preimage__field_descriptors, - preimage__field_indices_by_name, - 1, preimage__number_ranges, - (ProtobufCMessageInit) preimage__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor signature__field_descriptors[8] = -{ - { - "r1", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, r1), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "r2", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, r2), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "r3", - 3, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, r3), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "r4", - 4, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, r4), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "s1", - 5, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, s1), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "s2", - 6, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, s2), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "s3", - 7, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, s3), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "s4", - 8, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_FIXED64, - 0, /* quantifier_offset */ - offsetof(Signature, s4), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned signature__field_indices_by_name[] = { - 0, /* field[0] = r1 */ - 1, /* field[1] = r2 */ - 2, /* field[2] = r3 */ - 3, /* field[3] = r4 */ - 4, /* field[4] = s1 */ - 5, /* field[5] = s2 */ - 6, /* field[6] = s3 */ - 7, /* field[7] = s4 */ -}; -static const ProtobufCIntRange signature__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 8 } -}; -const ProtobufCMessageDescriptor signature__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "signature", - "Signature", - "Signature", - "", - sizeof(Signature), - 8, - signature__field_descriptors, - signature__field_indices_by_name, - 1, signature__number_ranges, - (ProtobufCMessageInit) signature__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor locktime__field_descriptors[2] = -{ - { - "seconds", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(Locktime, locktime_case), - offsetof(Locktime, seconds), - NULL, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "blocks", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(Locktime, locktime_case), - offsetof(Locktime, blocks), - NULL, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned locktime__field_indices_by_name[] = { - 1, /* field[1] = blocks */ - 0, /* field[0] = seconds */ -}; -static const ProtobufCIntRange locktime__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor locktime__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "locktime", - "Locktime", - "Locktime", - "", - sizeof(Locktime), - 2, - locktime__field_descriptors, - locktime__field_indices_by_name, - 1, locktime__number_ranges, - (ProtobufCMessageInit) locktime__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor bitcoin_pubkey__field_descriptors[1] = -{ - { - "key", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_BYTES, - 0, /* quantifier_offset */ - offsetof(BitcoinPubkey, key), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned bitcoin_pubkey__field_indices_by_name[] = { - 0, /* field[0] = key */ -}; -static const ProtobufCIntRange bitcoin_pubkey__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor bitcoin_pubkey__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "bitcoin_pubkey", - "BitcoinPubkey", - "BitcoinPubkey", - "", - sizeof(BitcoinPubkey), - 1, - bitcoin_pubkey__field_descriptors, - bitcoin_pubkey__field_indices_by_name, - 1, bitcoin_pubkey__number_ranges, - (ProtobufCMessageInit) bitcoin_pubkey__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const int64_t funding__fixed__default_value = 0ll; -static const int32_t funding__per_micro_satoshi__default_value = 0; -static const ProtobufCFieldDescriptor funding__field_descriptors[2] = -{ - { - "fixed", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_INT64, - offsetof(Funding, has_fixed), - offsetof(Funding, fixed), - NULL, - &funding__fixed__default_value, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "per_micro_satoshi", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_INT32, - offsetof(Funding, has_per_micro_satoshi), - offsetof(Funding, per_micro_satoshi), - NULL, - &funding__per_micro_satoshi__default_value, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned funding__field_indices_by_name[] = { - 0, /* field[0] = fixed */ - 1, /* field[1] = per_micro_satoshi */ -}; -static const ProtobufCIntRange funding__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor funding__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "funding", - "Funding", - "Funding", - "", - sizeof(Funding), - 2, - funding__field_descriptors, - funding__field_indices_by_name, - 1, funding__number_ranges, - (ProtobufCMessageInit) funding__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor authenticate__field_descriptors[2] = -{ - { - "node_id", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(Authenticate, node_id), - &bitcoin_pubkey__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "session_sig", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(Authenticate, session_sig), - &signature__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned authenticate__field_indices_by_name[] = { - 0, /* field[0] = node_id */ - 1, /* field[1] = session_sig */ -}; -static const ProtobufCIntRange authenticate__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor authenticate__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "authenticate", - "Authenticate", - "Authenticate", - "", - sizeof(Authenticate), - 2, - authenticate__field_descriptors, - authenticate__field_indices_by_name, - 1, authenticate__number_ranges, - (ProtobufCMessageInit) authenticate__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor init__field_descriptors[2] = -{ - { - "ack", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(Init, ack), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "features", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BYTES, - offsetof(Init, has_features), - offsetof(Init, features), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned init__field_indices_by_name[] = { - 0, /* field[0] = ack */ - 1, /* field[1] = features */ -}; -static const ProtobufCIntRange init__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor init__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "init", - "Init", - "Init", - "", - sizeof(Init), - 2, - init__field_descriptors, - init__field_indices_by_name, - 1, init__number_ranges, - (ProtobufCMessageInit) init__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCEnumValue open_channel__anchor_offer__enum_values_by_number[2] = -{ - { "WILL_CREATE_ANCHOR", "OPEN_CHANNEL__ANCHOR_OFFER__WILL_CREATE_ANCHOR", 1 }, - { "WONT_CREATE_ANCHOR", "OPEN_CHANNEL__ANCHOR_OFFER__WONT_CREATE_ANCHOR", 2 }, -}; -static const ProtobufCIntRange open_channel__anchor_offer__value_ranges[] = { -{1, 0},{0, 2} -}; -static const ProtobufCEnumValueIndex open_channel__anchor_offer__enum_values_by_name[2] = -{ - { "WILL_CREATE_ANCHOR", 0 }, - { "WONT_CREATE_ANCHOR", 1 }, -}; -const ProtobufCEnumDescriptor open_channel__anchor_offer__descriptor = -{ - PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, - "open_channel.anchor_offer", - "anchor_offer", - "OpenChannel__AnchorOffer", - "", - 2, - open_channel__anchor_offer__enum_values_by_number, - 2, - open_channel__anchor_offer__enum_values_by_name, - 1, - open_channel__anchor_offer__value_ranges, - NULL,NULL,NULL,NULL /* reserved[1234] */ -}; -static const uint32_t open_channel__min_depth__default_value = 0u; -static const ProtobufCFieldDescriptor open_channel__field_descriptors[8] = -{ - { - "delay", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenChannel, delay), - &locktime__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "revocation_hash", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenChannel, revocation_hash), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "commit_key", - 3, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenChannel, commit_key), - &bitcoin_pubkey__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "final_key", - 4, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenChannel, final_key), - &bitcoin_pubkey__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "anch", - 5, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_ENUM, - 0, /* quantifier_offset */ - offsetof(OpenChannel, anch), - &open_channel__anchor_offer__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "min_depth", - 6, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_UINT32, - offsetof(OpenChannel, has_min_depth), - offsetof(OpenChannel, min_depth), - NULL, - &open_channel__min_depth__default_value, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "initial_fee_rate", - 7, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(OpenChannel, initial_fee_rate), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "next_revocation_hash", - 8, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenChannel, next_revocation_hash), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned open_channel__field_indices_by_name[] = { - 4, /* field[4] = anch */ - 2, /* field[2] = commit_key */ - 0, /* field[0] = delay */ - 3, /* field[3] = final_key */ - 6, /* field[6] = initial_fee_rate */ - 5, /* field[5] = min_depth */ - 7, /* field[7] = next_revocation_hash */ - 1, /* field[1] = revocation_hash */ -}; -static const ProtobufCIntRange open_channel__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 8 } -}; -const ProtobufCMessageDescriptor open_channel__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "open_channel", - "OpenChannel", - "OpenChannel", - "", - sizeof(OpenChannel), - 8, - open_channel__field_descriptors, - open_channel__field_indices_by_name, - 1, open_channel__number_ranges, - (ProtobufCMessageInit) open_channel__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor open_anchor__field_descriptors[3] = -{ - { - "txid", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenAnchor, txid), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "output_index", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT32, - 0, /* quantifier_offset */ - offsetof(OpenAnchor, output_index), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "amount", - 3, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(OpenAnchor, amount), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned open_anchor__field_indices_by_name[] = { - 2, /* field[2] = amount */ - 1, /* field[1] = output_index */ - 0, /* field[0] = txid */ -}; -static const ProtobufCIntRange open_anchor__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 3 } -}; -const ProtobufCMessageDescriptor open_anchor__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "open_anchor", - "OpenAnchor", - "OpenAnchor", - "", - sizeof(OpenAnchor), - 3, - open_anchor__field_descriptors, - open_anchor__field_indices_by_name, - 1, open_anchor__number_ranges, - (ProtobufCMessageInit) open_anchor__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor open_commit_sig__field_descriptors[1] = -{ - { - "sig", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenCommitSig, sig), - &signature__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned open_commit_sig__field_indices_by_name[] = { - 0, /* field[0] = sig */ -}; -static const ProtobufCIntRange open_commit_sig__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor open_commit_sig__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "open_commit_sig", - "OpenCommitSig", - "OpenCommitSig", - "", - sizeof(OpenCommitSig), - 1, - open_commit_sig__field_descriptors, - open_commit_sig__field_indices_by_name, - 1, open_commit_sig__number_ranges, - (ProtobufCMessageInit) open_commit_sig__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor open_complete__field_descriptors[1] = -{ - { - "blockid", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(OpenComplete, blockid), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned open_complete__field_indices_by_name[] = { - 0, /* field[0] = blockid */ -}; -static const ProtobufCIntRange open_complete__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor open_complete__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "open_complete", - "OpenComplete", - "OpenComplete", - "", - sizeof(OpenComplete), - 1, - open_complete__field_descriptors, - open_complete__field_indices_by_name, - 1, open_complete__number_ranges, - (ProtobufCMessageInit) open_complete__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor route_step__field_descriptors[3] = -{ - { - "end", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_BOOL, - offsetof(RouteStep, next_case), - offsetof(RouteStep, end), - NULL, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "bitcoin", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(RouteStep, next_case), - offsetof(RouteStep, bitcoin), - &bitcoin_pubkey__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "amount", - 4, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT32, - 0, /* quantifier_offset */ - offsetof(RouteStep, amount), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned route_step__field_indices_by_name[] = { - 2, /* field[2] = amount */ - 1, /* field[1] = bitcoin */ - 0, /* field[0] = end */ -}; -static const ProtobufCIntRange route_step__number_ranges[2 + 1] = -{ - { 1, 0 }, - { 4, 2 }, - { 0, 3 } -}; -const ProtobufCMessageDescriptor route_step__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "route_step", - "RouteStep", - "RouteStep", - "", - sizeof(RouteStep), - 3, - route_step__field_descriptors, - route_step__field_indices_by_name, - 2, route_step__number_ranges, - (ProtobufCMessageInit) route_step__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor route__field_descriptors[1] = -{ - { - "steps", - 1, - PROTOBUF_C_LABEL_REPEATED, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Route, n_steps), - offsetof(Route, steps), - &route_step__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned route__field_indices_by_name[] = { - 0, /* field[0] = steps */ -}; -static const ProtobufCIntRange route__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor route__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "route", - "Route", - "Route", - "", - sizeof(Route), - 1, - route__field_descriptors, - route__field_indices_by_name, - 1, route__number_ranges, - (ProtobufCMessageInit) route__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor routing__field_descriptors[1] = -{ - { - "info", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_BYTES, - 0, /* quantifier_offset */ - offsetof(Routing, info), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned routing__field_indices_by_name[] = { - 0, /* field[0] = info */ -}; -static const ProtobufCIntRange routing__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor routing__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "routing", - "Routing", - "Routing", - "", - sizeof(Routing), - 1, - routing__field_descriptors, - routing__field_indices_by_name, - 1, routing__number_ranges, - (ProtobufCMessageInit) routing__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor update_add_htlc__field_descriptors[5] = -{ - { - "id", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(UpdateAddHtlc, id), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "amount_msat", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT32, - 0, /* quantifier_offset */ - offsetof(UpdateAddHtlc, amount_msat), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "r_hash", - 3, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateAddHtlc, r_hash), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "expiry", - 4, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateAddHtlc, expiry), - &locktime__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "route", - 5, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateAddHtlc, route), - &routing__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned update_add_htlc__field_indices_by_name[] = { - 1, /* field[1] = amount_msat */ - 3, /* field[3] = expiry */ - 0, /* field[0] = id */ - 2, /* field[2] = r_hash */ - 4, /* field[4] = route */ -}; -static const ProtobufCIntRange update_add_htlc__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 5 } -}; -const ProtobufCMessageDescriptor update_add_htlc__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "update_add_htlc", - "UpdateAddHtlc", - "UpdateAddHtlc", - "", - sizeof(UpdateAddHtlc), - 5, - update_add_htlc__field_descriptors, - update_add_htlc__field_indices_by_name, - 1, update_add_htlc__number_ranges, - (ProtobufCMessageInit) update_add_htlc__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor update_fulfill_htlc__field_descriptors[2] = -{ - { - "id", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(UpdateFulfillHtlc, id), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "r", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateFulfillHtlc, r), - &preimage__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned update_fulfill_htlc__field_indices_by_name[] = { - 0, /* field[0] = id */ - 1, /* field[1] = r */ -}; -static const ProtobufCIntRange update_fulfill_htlc__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor update_fulfill_htlc__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "update_fulfill_htlc", - "UpdateFulfillHtlc", - "UpdateFulfillHtlc", - "", - sizeof(UpdateFulfillHtlc), - 2, - update_fulfill_htlc__field_descriptors, - update_fulfill_htlc__field_indices_by_name, - 1, update_fulfill_htlc__number_ranges, - (ProtobufCMessageInit) update_fulfill_htlc__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor fail_info__field_descriptors[3] = -{ - { - "id", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(FailInfo, id), - &bitcoin_pubkey__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "error_code", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT32, - 0, /* quantifier_offset */ - offsetof(FailInfo, error_code), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "reason", - 3, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(FailInfo, reason), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned fail_info__field_indices_by_name[] = { - 1, /* field[1] = error_code */ - 0, /* field[0] = id */ - 2, /* field[2] = reason */ -}; -static const ProtobufCIntRange fail_info__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 3 } -}; -const ProtobufCMessageDescriptor fail_info__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "fail_info", - "FailInfo", - "FailInfo", - "", - sizeof(FailInfo), - 3, - fail_info__field_descriptors, - fail_info__field_indices_by_name, - 1, fail_info__number_ranges, - (ProtobufCMessageInit) fail_info__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor fail_reason__field_descriptors[1] = -{ - { - "info", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_BYTES, - 0, /* quantifier_offset */ - offsetof(FailReason, info), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned fail_reason__field_indices_by_name[] = { - 0, /* field[0] = info */ -}; -static const ProtobufCIntRange fail_reason__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor fail_reason__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "fail_reason", - "FailReason", - "FailReason", - "", - sizeof(FailReason), - 1, - fail_reason__field_descriptors, - fail_reason__field_indices_by_name, - 1, fail_reason__number_ranges, - (ProtobufCMessageInit) fail_reason__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor update_fail_htlc__field_descriptors[2] = -{ - { - "id", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(UpdateFailHtlc, id), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "reason", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateFailHtlc, reason), - &fail_reason__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned update_fail_htlc__field_indices_by_name[] = { - 0, /* field[0] = id */ - 1, /* field[1] = reason */ -}; -static const ProtobufCIntRange update_fail_htlc__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor update_fail_htlc__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "update_fail_htlc", - "UpdateFailHtlc", - "UpdateFailHtlc", - "", - sizeof(UpdateFailHtlc), - 2, - update_fail_htlc__field_descriptors, - update_fail_htlc__field_indices_by_name, - 1, update_fail_htlc__number_ranges, - (ProtobufCMessageInit) update_fail_htlc__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor update_fee__field_descriptors[1] = -{ - { - "fee_rate", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT32, - 0, /* quantifier_offset */ - offsetof(UpdateFee, fee_rate), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned update_fee__field_indices_by_name[] = { - 0, /* field[0] = fee_rate */ -}; -static const ProtobufCIntRange update_fee__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor update_fee__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "update_fee", - "UpdateFee", - "UpdateFee", - "", - sizeof(UpdateFee), - 1, - update_fee__field_descriptors, - update_fee__field_indices_by_name, - 1, update_fee__number_ranges, - (ProtobufCMessageInit) update_fee__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor update_commit__field_descriptors[1] = -{ - { - "sig", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateCommit, sig), - &signature__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned update_commit__field_indices_by_name[] = { - 0, /* field[0] = sig */ -}; -static const ProtobufCIntRange update_commit__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor update_commit__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "update_commit", - "UpdateCommit", - "UpdateCommit", - "", - sizeof(UpdateCommit), - 1, - update_commit__field_descriptors, - update_commit__field_indices_by_name, - 1, update_commit__number_ranges, - (ProtobufCMessageInit) update_commit__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor update_revocation__field_descriptors[2] = -{ - { - "revocation_preimage", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateRevocation, revocation_preimage), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "next_revocation_hash", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(UpdateRevocation, next_revocation_hash), - &sha256_hash__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned update_revocation__field_indices_by_name[] = { - 1, /* field[1] = next_revocation_hash */ - 0, /* field[0] = revocation_preimage */ -}; -static const ProtobufCIntRange update_revocation__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor update_revocation__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "update_revocation", - "UpdateRevocation", - "UpdateRevocation", - "", - sizeof(UpdateRevocation), - 2, - update_revocation__field_descriptors, - update_revocation__field_indices_by_name, - 1, update_revocation__number_ranges, - (ProtobufCMessageInit) update_revocation__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor close_shutdown__field_descriptors[1] = -{ - { - "scriptPubkey", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_BYTES, - 0, /* quantifier_offset */ - offsetof(CloseShutdown, scriptpubkey), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned close_shutdown__field_indices_by_name[] = { - 0, /* field[0] = scriptPubkey */ -}; -static const ProtobufCIntRange close_shutdown__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor close_shutdown__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "close_shutdown", - "CloseShutdown", - "CloseShutdown", - "", - sizeof(CloseShutdown), - 1, - close_shutdown__field_descriptors, - close_shutdown__field_indices_by_name, - 1, close_shutdown__number_ranges, - (ProtobufCMessageInit) close_shutdown__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor close_signature__field_descriptors[2] = -{ - { - "close_fee", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT64, - 0, /* quantifier_offset */ - offsetof(CloseSignature, close_fee), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "sig", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_MESSAGE, - 0, /* quantifier_offset */ - offsetof(CloseSignature, sig), - &signature__descriptor, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned close_signature__field_indices_by_name[] = { - 0, /* field[0] = close_fee */ - 1, /* field[1] = sig */ -}; -static const ProtobufCIntRange close_signature__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor close_signature__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "close_signature", - "CloseSignature", - "CloseSignature", - "", - sizeof(CloseSignature), - 2, - close_signature__field_descriptors, - close_signature__field_indices_by_name, - 1, close_signature__number_ranges, - (ProtobufCMessageInit) close_signature__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor error__field_descriptors[1] = -{ - { - "problem", - 1, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_STRING, - 0, /* quantifier_offset */ - offsetof(Error, problem), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned error__field_indices_by_name[] = { - 0, /* field[0] = problem */ -}; -static const ProtobufCIntRange error__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 1 } -}; -const ProtobufCMessageDescriptor error__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "error", - "Error", - "Error", - "", - sizeof(Error), - 1, - error__field_descriptors, - error__field_indices_by_name, - 1, error__number_ranges, - (ProtobufCMessageInit) error__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor nested_pkt__field_descriptors[2] = -{ - { - "type", - 1, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_UINT32, - 0, /* quantifier_offset */ - offsetof(NestedPkt, type), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "inner_pkt", - 2, - PROTOBUF_C_LABEL_REQUIRED, - PROTOBUF_C_TYPE_BYTES, - 0, /* quantifier_offset */ - offsetof(NestedPkt, inner_pkt), - NULL, - NULL, - 0, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned nested_pkt__field_indices_by_name[] = { - 1, /* field[1] = inner_pkt */ - 0, /* field[0] = type */ -}; -static const ProtobufCIntRange nested_pkt__number_ranges[1 + 1] = -{ - { 1, 0 }, - { 0, 2 } -}; -const ProtobufCMessageDescriptor nested_pkt__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "nested_pkt", - "NestedPkt", - "NestedPkt", - "", - sizeof(NestedPkt), - 2, - nested_pkt__field_descriptors, - nested_pkt__field_indices_by_name, - 1, nested_pkt__number_ranges, - (ProtobufCMessageInit) nested_pkt__init, - NULL,NULL,NULL /* reserved[123] */ -}; -static const ProtobufCFieldDescriptor pkt__field_descriptors[16] = -{ - { - "update_add_htlc", - 2, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, update_add_htlc), - &update_add_htlc__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "update_fulfill_htlc", - 3, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, update_fulfill_htlc), - &update_fulfill_htlc__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "update_fail_htlc", - 4, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, update_fail_htlc), - &update_fail_htlc__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "update_fee", - 5, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, update_fee), - &update_fee__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "update_commit", - 6, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, update_commit), - &update_commit__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "update_revocation", - 7, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, update_revocation), - &update_revocation__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "open", - 20, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, open), - &open_channel__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "open_anchor", - 21, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, open_anchor), - &open_anchor__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "open_commit_sig", - 22, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, open_commit_sig), - &open_commit_sig__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "open_complete", - 23, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, open_complete), - &open_complete__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "close_shutdown", - 30, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, close_shutdown), - &close_shutdown__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "close_signature", - 31, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, close_signature), - &close_signature__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "error", - 40, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, error), - &error__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "auth", - 50, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, auth), - &authenticate__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "init", - 51, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, init), - &init__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, - { - "nested", - 128, - PROTOBUF_C_LABEL_OPTIONAL, - PROTOBUF_C_TYPE_MESSAGE, - offsetof(Pkt, pkt_case), - offsetof(Pkt, nested), - &nested_pkt__descriptor, - NULL, - 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ - 0,NULL,NULL /* reserved1,reserved2, etc */ - }, -}; -static const unsigned pkt__field_indices_by_name[] = { - 13, /* field[13] = auth */ - 10, /* field[10] = close_shutdown */ - 11, /* field[11] = close_signature */ - 12, /* field[12] = error */ - 14, /* field[14] = init */ - 15, /* field[15] = nested */ - 6, /* field[6] = open */ - 7, /* field[7] = open_anchor */ - 8, /* field[8] = open_commit_sig */ - 9, /* field[9] = open_complete */ - 0, /* field[0] = update_add_htlc */ - 4, /* field[4] = update_commit */ - 2, /* field[2] = update_fail_htlc */ - 3, /* field[3] = update_fee */ - 1, /* field[1] = update_fulfill_htlc */ - 5, /* field[5] = update_revocation */ -}; -static const ProtobufCIntRange pkt__number_ranges[6 + 1] = -{ - { 2, 0 }, - { 20, 6 }, - { 30, 10 }, - { 40, 12 }, - { 50, 13 }, - { 128, 15 }, - { 0, 16 } -}; -const ProtobufCMessageDescriptor pkt__descriptor = -{ - PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, - "pkt", - "Pkt", - "Pkt", - "", - sizeof(Pkt), - 16, - pkt__field_descriptors, - pkt__field_indices_by_name, - 6, pkt__number_ranges, - (ProtobufCMessageInit) pkt__init, - NULL,NULL,NULL /* reserved[123] */ -}; diff --git a/lightning.pb-c.h b/lightning.pb-c.h deleted file mode 100644 index 039e82847..000000000 --- a/lightning.pb-c.h +++ /dev/null @@ -1,1290 +0,0 @@ -/* Generated by the protocol buffer compiler. DO NOT EDIT! */ -/* Generated from: lightning.proto */ - -#ifndef PROTOBUF_C_lightning_2eproto__INCLUDED -#define PROTOBUF_C_lightning_2eproto__INCLUDED - -#include - -PROTOBUF_C__BEGIN_DECLS - -#if PROTOBUF_C_VERSION_NUMBER < 1000000 -# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. -#elif 1002001 < PROTOBUF_C_MIN_COMPILER_VERSION -# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. -#endif - - -typedef struct _Sha256Hash Sha256Hash; -typedef struct _Preimage Preimage; -typedef struct _Signature Signature; -typedef struct _Locktime Locktime; -typedef struct _BitcoinPubkey BitcoinPubkey; -typedef struct _Funding Funding; -typedef struct _Authenticate Authenticate; -typedef struct _Init Init; -typedef struct _OpenChannel OpenChannel; -typedef struct _OpenAnchor OpenAnchor; -typedef struct _OpenCommitSig OpenCommitSig; -typedef struct _OpenComplete OpenComplete; -typedef struct _RouteStep RouteStep; -typedef struct _Route Route; -typedef struct _Routing Routing; -typedef struct _UpdateAddHtlc UpdateAddHtlc; -typedef struct _UpdateFulfillHtlc UpdateFulfillHtlc; -typedef struct _FailInfo FailInfo; -typedef struct _FailReason FailReason; -typedef struct _UpdateFailHtlc UpdateFailHtlc; -typedef struct _UpdateFee UpdateFee; -typedef struct _UpdateCommit UpdateCommit; -typedef struct _UpdateRevocation UpdateRevocation; -typedef struct _CloseShutdown CloseShutdown; -typedef struct _CloseSignature CloseSignature; -typedef struct _Error Error; -typedef struct _NestedPkt NestedPkt; -typedef struct _Pkt Pkt; - - -/* --- enums --- */ - -typedef enum _OpenChannel__AnchorOffer { - /* - * I will create the anchor - */ - OPEN_CHANNEL__ANCHOR_OFFER__WILL_CREATE_ANCHOR = 1, - /* - * I won't create the anchor - */ - OPEN_CHANNEL__ANCHOR_OFFER__WONT_CREATE_ANCHOR = 2 - PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPEN_CHANNEL__ANCHOR_OFFER) -} OpenChannel__AnchorOffer; - -/* --- messages --- */ - -/* - * Protobufs don't have fixed-length fields, so these are a hack. - */ -struct _Sha256Hash -{ - ProtobufCMessage base; - uint64_t a; - uint64_t b; - uint64_t c; - uint64_t d; -}; -#define SHA256_HASH__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&sha256_hash__descriptor) \ - , 0, 0, 0, 0 } - - -struct _Preimage -{ - ProtobufCMessage base; - uint64_t a; - uint64_t b; - uint64_t c; - uint64_t d; -}; -#define PREIMAGE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&preimage__descriptor) \ - , 0, 0, 0, 0 } - - -struct _Signature -{ - ProtobufCMessage base; - uint64_t r1; - uint64_t r2; - uint64_t r3; - uint64_t r4; - uint64_t s1; - uint64_t s2; - uint64_t s3; - uint64_t s4; -}; -#define SIGNATURE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&signature__descriptor) \ - , 0, 0, 0, 0, 0, 0, 0, 0 } - - -typedef enum { - LOCKTIME__LOCKTIME__NOT_SET = 0, - LOCKTIME__LOCKTIME_SECONDS = 1, - LOCKTIME__LOCKTIME_BLOCKS = 2, -} Locktime__LocktimeCase; - -struct _Locktime -{ - ProtobufCMessage base; - Locktime__LocktimeCase locktime_case; - union { - uint32_t seconds; - uint32_t blocks; - }; -}; -#define LOCKTIME__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&locktime__descriptor) \ - , LOCKTIME__LOCKTIME__NOT_SET, {0} } - - -/* - * Pubkey for commitment transaction input. - */ -struct _BitcoinPubkey -{ - ProtobufCMessage base; - /* - * Must be 33 bytes. - */ - ProtobufCBinaryData key; -}; -#define BITCOIN_PUBKEY__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&bitcoin_pubkey__descriptor) \ - , {0,NULL} } - - -/* - * How much a node charges (or pays!) for sending. - */ -struct _Funding -{ - ProtobufCMessage base; - /* - * Base amount (in satoshi). - */ - protobuf_c_boolean has_fixed; - int64_t fixed; - /* - * This is charge per millionth of a satoshi. - */ - protobuf_c_boolean has_per_micro_satoshi; - int32_t per_micro_satoshi; -}; -#define FUNDING__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&funding__descriptor) \ - , 0,0ll, 0,0 } - - -/* - * Set channel params. - */ -struct _Authenticate -{ - ProtobufCMessage base; - /* - * Which node this is. - */ - BitcoinPubkey *node_id; - /* - * Signature of your session key. * - */ - Signature *session_sig; -}; -#define AUTHENTICATE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&authenticate__descriptor) \ - , NULL, NULL } - - -/* - * We're authenticated. Here's what we've received already. - */ -struct _Init -{ - ProtobufCMessage base; - /* - * How many update_commit and update_revocation messages already received - */ - uint64_t ack; - /* - * What features do we support (odd) and require (even) - */ - protobuf_c_boolean has_features; - ProtobufCBinaryData features; -}; -#define INIT__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&init__descriptor) \ - , 0, 0,{0,NULL} } - - -/* - * Set channel params. - */ -struct _OpenChannel -{ - ProtobufCMessage base; - /* - * Relative locktime for outputs going to us. - */ - Locktime *delay; - /* - * Hash for revoking first commitment transaction. - */ - Sha256Hash *revocation_hash; - /* - * Hash for revoking second commitment transaction. - */ - Sha256Hash *next_revocation_hash; - /* - * Pubkey for anchor to pay into commitment tx. - */ - BitcoinPubkey *commit_key; - /* - * How to pay money to us from commit_tx. - */ - BitcoinPubkey *final_key; - OpenChannel__AnchorOffer anch; - /* - * How far must anchor be buried before we consider channel live? - */ - protobuf_c_boolean has_min_depth; - uint32_t min_depth; - /* - * How much fee would I like on commitment tx? - */ - uint64_t initial_fee_rate; -}; -#define OPEN_CHANNEL__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&open_channel__descriptor) \ - , NULL, NULL, NULL, NULL, NULL, 0, 0,0u, 0 } - - -/* - * Whoever is supplying anchor sends this. - */ -struct _OpenAnchor -{ - ProtobufCMessage base; - /* - * Transaction ID of anchor. - */ - Sha256Hash *txid; - /* - * Which output is going to the 2 of 2. - */ - uint32_t output_index; - /* - * Amount of anchor output. - */ - uint64_t amount; -}; -#define OPEN_ANCHOR__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&open_anchor__descriptor) \ - , NULL, 0, 0 } - - -/* - * Reply: signature for your initial commitment tx - */ -struct _OpenCommitSig -{ - ProtobufCMessage base; - Signature *sig; -}; -#define OPEN_COMMIT_SIG__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&open_commit_sig__descriptor) \ - , NULL } - - -/* - * Indicates we've seen anchor reach min-depth. - */ -struct _OpenComplete -{ - ProtobufCMessage base; - /* - * Block it went into. - */ - /* - * FIXME: add a merkle proof plus block headers here? - */ - Sha256Hash *blockid; -}; -#define OPEN_COMPLETE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&open_complete__descriptor) \ - , NULL } - - -typedef enum { - ROUTE_STEP__NEXT__NOT_SET = 0, - ROUTE_STEP__NEXT_END = 1, - ROUTE_STEP__NEXT_BITCOIN = 2, -} RouteStep__NextCase; - -struct _RouteStep -{ - ProtobufCMessage base; - /* - * How much to forward (difference is fee) - */ - uint32_t amount; - RouteStep__NextCase next_case; - union { - /* - * Actually, this is the last one - */ - protobuf_c_boolean end; - /* - * Next lightning node. - */ - /* - * Other realms go here... - */ - BitcoinPubkey *bitcoin; - }; -}; -#define ROUTE_STEP__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&route_step__descriptor) \ - , 0, ROUTE_STEP__NEXT__NOT_SET, {0} } - - -struct _Route -{ - ProtobufCMessage base; - size_t n_steps; - RouteStep **steps; -}; -#define ROUTE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&route__descriptor) \ - , 0,NULL } - - -struct _Routing -{ - ProtobufCMessage base; - ProtobufCBinaryData info; -}; -#define ROUTING__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&routing__descriptor) \ - , {0,NULL} } - - -/* - * Start a new commitment tx to add an HTLC me -> you. - */ -struct _UpdateAddHtlc -{ - ProtobufCMessage base; - /* - * Unique identifier for this HTLC. - */ - uint64_t id; - /* - * Amount for htlc (millisatoshi) - */ - uint32_t amount_msat; - /* - * Hash for HTLC R value. - */ - Sha256Hash *r_hash; - /* - * Time at which HTLC expires (absolute) - */ - Locktime *expiry; - /* - * Onion-wrapped routing information. - */ - Routing *route; -}; -#define UPDATE_ADD_HTLC__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&update_add_htlc__descriptor) \ - , 0, 0, NULL, NULL, NULL } - - -/* - * Complete your HTLC: I have the R value, pay me! - */ -struct _UpdateFulfillHtlc -{ - ProtobufCMessage base; - /* - * Which HTLC - */ - uint64_t id; - /* - * HTLC payment_preimage. - */ - Preimage *r; -}; -#define UPDATE_FULFILL_HTLC__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&update_fulfill_htlc__descriptor) \ - , 0, NULL } - - -/* - * This is encrypted in fail_reason. - */ -struct _FailInfo -{ - ProtobufCMessage base; - BitcoinPubkey *id; - uint32_t error_code; - char *reason; -}; -#define FAIL_INFO__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&fail_info__descriptor) \ - , NULL, 0, NULL } - - -struct _FailReason -{ - ProtobufCMessage base; - ProtobufCBinaryData info; -}; -#define FAIL_REASON__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&fail_reason__descriptor) \ - , {0,NULL} } - - -struct _UpdateFailHtlc -{ - ProtobufCMessage base; - /* - * Which HTLC - */ - uint64_t id; - /* - * Reason for failure (for relay to initial node) - */ - FailReason *reason; -}; -#define UPDATE_FAIL_HTLC__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&update_fail_htlc__descriptor) \ - , 0, NULL } - - -/* - * Fee rate change proposal - */ -struct _UpdateFee -{ - ProtobufCMessage base; - uint32_t fee_rate; -}; -#define UPDATE_FEE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&update_fee__descriptor) \ - , 0 } - - -/* - * Commit all the staged changes. - */ -struct _UpdateCommit -{ - ProtobufCMessage base; - /* - * Signature for your new commitment tx (if any outputs are HTLCs or to you) - */ - Signature *sig; -}; -#define UPDATE_COMMIT__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&update_commit__descriptor) \ - , NULL } - - -/* - * Complete the update. - */ -struct _UpdateRevocation -{ - ProtobufCMessage base; - /* - * Hash preimage which revokes old commitment tx. - */ - Sha256Hash *revocation_preimage; - /* - * Revocation hash for my next commit transaction - */ - Sha256Hash *next_revocation_hash; -}; -#define UPDATE_REVOCATION__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&update_revocation__descriptor) \ - , NULL, NULL } - - -/* - * Start clearing out the channel HTLCs so we can close it - */ -struct _CloseShutdown -{ - ProtobufCMessage base; - /* - * Output script for mutual close tx. - */ - ProtobufCBinaryData scriptpubkey; -}; -#define CLOSE_SHUTDOWN__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&close_shutdown__descriptor) \ - , {0,NULL} } - - -struct _CloseSignature -{ - ProtobufCMessage base; - /* - * Fee in satoshis. - */ - uint64_t close_fee; - /* - * Signature on the close transaction. - */ - Signature *sig; -}; -#define CLOSE_SIGNATURE__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&close_signature__descriptor) \ - , 0, NULL } - - -/* - * This means we're going to hang up; it's to help diagnose only! - */ -struct _Error -{ - ProtobufCMessage base; - char *problem; -}; -#define ERROR__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&error__descriptor) \ - , NULL } - - -/* - * Nested message to transport standard protocol messages through the legacy transport - */ -struct _NestedPkt -{ - ProtobufCMessage base; - uint32_t type; - ProtobufCBinaryData inner_pkt; -}; -#define NESTED_PKT__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&nested_pkt__descriptor) \ - , 0, {0,NULL} } - - -typedef enum { - PKT__PKT__NOT_SET = 0, - PKT__PKT_AUTH = 50, - PKT__PKT_INIT = 51, - PKT__PKT_OPEN = 20, - PKT__PKT_OPEN_ANCHOR = 21, - PKT__PKT_OPEN_COMMIT_SIG = 22, - PKT__PKT_OPEN_COMPLETE = 23, - PKT__PKT_UPDATE_ADD_HTLC = 2, - PKT__PKT_UPDATE_FULFILL_HTLC = 3, - PKT__PKT_UPDATE_FAIL_HTLC = 4, - PKT__PKT_UPDATE_FEE = 5, - PKT__PKT_UPDATE_COMMIT = 6, - PKT__PKT_UPDATE_REVOCATION = 7, - PKT__PKT_CLOSE_SHUTDOWN = 30, - PKT__PKT_CLOSE_SIGNATURE = 31, - PKT__PKT_ERROR = 40, - PKT__PKT_NESTED = 128, -} Pkt__PktCase; - -/* - * This is the union which defines all of them - */ -struct _Pkt -{ - ProtobufCMessage base; - Pkt__PktCase pkt_case; - union { - /* - * Start of connection - */ - Authenticate *auth; - Init *init; - /* - * Opening - */ - OpenChannel *open; - OpenAnchor *open_anchor; - OpenCommitSig *open_commit_sig; - OpenComplete *open_complete; - /* - * Updating (most common) - */ - UpdateAddHtlc *update_add_htlc; - UpdateFulfillHtlc *update_fulfill_htlc; - UpdateFailHtlc *update_fail_htlc; - UpdateFee *update_fee; - UpdateCommit *update_commit; - UpdateRevocation *update_revocation; - /* - * Closing - */ - CloseShutdown *close_shutdown; - CloseSignature *close_signature; - /* - * Unexpected issue. - */ - Error *error; - /* - * Shim to upgrade to new packet format - */ - NestedPkt *nested; - }; -}; -#define PKT__INIT \ - { PROTOBUF_C_MESSAGE_INIT (&pkt__descriptor) \ - , PKT__PKT__NOT_SET, {0} } - - -/* Sha256Hash methods */ -void sha256_hash__init - (Sha256Hash *message); -size_t sha256_hash__get_packed_size - (const Sha256Hash *message); -size_t sha256_hash__pack - (const Sha256Hash *message, - uint8_t *out); -size_t sha256_hash__pack_to_buffer - (const Sha256Hash *message, - ProtobufCBuffer *buffer); -Sha256Hash * - sha256_hash__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void sha256_hash__free_unpacked - (Sha256Hash *message, - ProtobufCAllocator *allocator); -/* Preimage methods */ -void preimage__init - (Preimage *message); -size_t preimage__get_packed_size - (const Preimage *message); -size_t preimage__pack - (const Preimage *message, - uint8_t *out); -size_t preimage__pack_to_buffer - (const Preimage *message, - ProtobufCBuffer *buffer); -Preimage * - preimage__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void preimage__free_unpacked - (Preimage *message, - ProtobufCAllocator *allocator); -/* Signature methods */ -void signature__init - (Signature *message); -size_t signature__get_packed_size - (const Signature *message); -size_t signature__pack - (const Signature *message, - uint8_t *out); -size_t signature__pack_to_buffer - (const Signature *message, - ProtobufCBuffer *buffer); -Signature * - signature__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void signature__free_unpacked - (Signature *message, - ProtobufCAllocator *allocator); -/* Locktime methods */ -void locktime__init - (Locktime *message); -size_t locktime__get_packed_size - (const Locktime *message); -size_t locktime__pack - (const Locktime *message, - uint8_t *out); -size_t locktime__pack_to_buffer - (const Locktime *message, - ProtobufCBuffer *buffer); -Locktime * - locktime__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void locktime__free_unpacked - (Locktime *message, - ProtobufCAllocator *allocator); -/* BitcoinPubkey methods */ -void bitcoin_pubkey__init - (BitcoinPubkey *message); -size_t bitcoin_pubkey__get_packed_size - (const BitcoinPubkey *message); -size_t bitcoin_pubkey__pack - (const BitcoinPubkey *message, - uint8_t *out); -size_t bitcoin_pubkey__pack_to_buffer - (const BitcoinPubkey *message, - ProtobufCBuffer *buffer); -BitcoinPubkey * - bitcoin_pubkey__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void bitcoin_pubkey__free_unpacked - (BitcoinPubkey *message, - ProtobufCAllocator *allocator); -/* Funding methods */ -void funding__init - (Funding *message); -size_t funding__get_packed_size - (const Funding *message); -size_t funding__pack - (const Funding *message, - uint8_t *out); -size_t funding__pack_to_buffer - (const Funding *message, - ProtobufCBuffer *buffer); -Funding * - funding__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void funding__free_unpacked - (Funding *message, - ProtobufCAllocator *allocator); -/* Authenticate methods */ -void authenticate__init - (Authenticate *message); -size_t authenticate__get_packed_size - (const Authenticate *message); -size_t authenticate__pack - (const Authenticate *message, - uint8_t *out); -size_t authenticate__pack_to_buffer - (const Authenticate *message, - ProtobufCBuffer *buffer); -Authenticate * - authenticate__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void authenticate__free_unpacked - (Authenticate *message, - ProtobufCAllocator *allocator); -/* Init methods */ -void init__init - (Init *message); -size_t init__get_packed_size - (const Init *message); -size_t init__pack - (const Init *message, - uint8_t *out); -size_t init__pack_to_buffer - (const Init *message, - ProtobufCBuffer *buffer); -Init * - init__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void init__free_unpacked - (Init *message, - ProtobufCAllocator *allocator); -/* OpenChannel methods */ -void open_channel__init - (OpenChannel *message); -size_t open_channel__get_packed_size - (const OpenChannel *message); -size_t open_channel__pack - (const OpenChannel *message, - uint8_t *out); -size_t open_channel__pack_to_buffer - (const OpenChannel *message, - ProtobufCBuffer *buffer); -OpenChannel * - open_channel__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void open_channel__free_unpacked - (OpenChannel *message, - ProtobufCAllocator *allocator); -/* OpenAnchor methods */ -void open_anchor__init - (OpenAnchor *message); -size_t open_anchor__get_packed_size - (const OpenAnchor *message); -size_t open_anchor__pack - (const OpenAnchor *message, - uint8_t *out); -size_t open_anchor__pack_to_buffer - (const OpenAnchor *message, - ProtobufCBuffer *buffer); -OpenAnchor * - open_anchor__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void open_anchor__free_unpacked - (OpenAnchor *message, - ProtobufCAllocator *allocator); -/* OpenCommitSig methods */ -void open_commit_sig__init - (OpenCommitSig *message); -size_t open_commit_sig__get_packed_size - (const OpenCommitSig *message); -size_t open_commit_sig__pack - (const OpenCommitSig *message, - uint8_t *out); -size_t open_commit_sig__pack_to_buffer - (const OpenCommitSig *message, - ProtobufCBuffer *buffer); -OpenCommitSig * - open_commit_sig__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void open_commit_sig__free_unpacked - (OpenCommitSig *message, - ProtobufCAllocator *allocator); -/* OpenComplete methods */ -void open_complete__init - (OpenComplete *message); -size_t open_complete__get_packed_size - (const OpenComplete *message); -size_t open_complete__pack - (const OpenComplete *message, - uint8_t *out); -size_t open_complete__pack_to_buffer - (const OpenComplete *message, - ProtobufCBuffer *buffer); -OpenComplete * - open_complete__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void open_complete__free_unpacked - (OpenComplete *message, - ProtobufCAllocator *allocator); -/* RouteStep methods */ -void route_step__init - (RouteStep *message); -size_t route_step__get_packed_size - (const RouteStep *message); -size_t route_step__pack - (const RouteStep *message, - uint8_t *out); -size_t route_step__pack_to_buffer - (const RouteStep *message, - ProtobufCBuffer *buffer); -RouteStep * - route_step__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void route_step__free_unpacked - (RouteStep *message, - ProtobufCAllocator *allocator); -/* Route methods */ -void route__init - (Route *message); -size_t route__get_packed_size - (const Route *message); -size_t route__pack - (const Route *message, - uint8_t *out); -size_t route__pack_to_buffer - (const Route *message, - ProtobufCBuffer *buffer); -Route * - route__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void route__free_unpacked - (Route *message, - ProtobufCAllocator *allocator); -/* Routing methods */ -void routing__init - (Routing *message); -size_t routing__get_packed_size - (const Routing *message); -size_t routing__pack - (const Routing *message, - uint8_t *out); -size_t routing__pack_to_buffer - (const Routing *message, - ProtobufCBuffer *buffer); -Routing * - routing__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void routing__free_unpacked - (Routing *message, - ProtobufCAllocator *allocator); -/* UpdateAddHtlc methods */ -void update_add_htlc__init - (UpdateAddHtlc *message); -size_t update_add_htlc__get_packed_size - (const UpdateAddHtlc *message); -size_t update_add_htlc__pack - (const UpdateAddHtlc *message, - uint8_t *out); -size_t update_add_htlc__pack_to_buffer - (const UpdateAddHtlc *message, - ProtobufCBuffer *buffer); -UpdateAddHtlc * - update_add_htlc__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void update_add_htlc__free_unpacked - (UpdateAddHtlc *message, - ProtobufCAllocator *allocator); -/* UpdateFulfillHtlc methods */ -void update_fulfill_htlc__init - (UpdateFulfillHtlc *message); -size_t update_fulfill_htlc__get_packed_size - (const UpdateFulfillHtlc *message); -size_t update_fulfill_htlc__pack - (const UpdateFulfillHtlc *message, - uint8_t *out); -size_t update_fulfill_htlc__pack_to_buffer - (const UpdateFulfillHtlc *message, - ProtobufCBuffer *buffer); -UpdateFulfillHtlc * - update_fulfill_htlc__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void update_fulfill_htlc__free_unpacked - (UpdateFulfillHtlc *message, - ProtobufCAllocator *allocator); -/* FailInfo methods */ -void fail_info__init - (FailInfo *message); -size_t fail_info__get_packed_size - (const FailInfo *message); -size_t fail_info__pack - (const FailInfo *message, - uint8_t *out); -size_t fail_info__pack_to_buffer - (const FailInfo *message, - ProtobufCBuffer *buffer); -FailInfo * - fail_info__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void fail_info__free_unpacked - (FailInfo *message, - ProtobufCAllocator *allocator); -/* FailReason methods */ -void fail_reason__init - (FailReason *message); -size_t fail_reason__get_packed_size - (const FailReason *message); -size_t fail_reason__pack - (const FailReason *message, - uint8_t *out); -size_t fail_reason__pack_to_buffer - (const FailReason *message, - ProtobufCBuffer *buffer); -FailReason * - fail_reason__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void fail_reason__free_unpacked - (FailReason *message, - ProtobufCAllocator *allocator); -/* UpdateFailHtlc methods */ -void update_fail_htlc__init - (UpdateFailHtlc *message); -size_t update_fail_htlc__get_packed_size - (const UpdateFailHtlc *message); -size_t update_fail_htlc__pack - (const UpdateFailHtlc *message, - uint8_t *out); -size_t update_fail_htlc__pack_to_buffer - (const UpdateFailHtlc *message, - ProtobufCBuffer *buffer); -UpdateFailHtlc * - update_fail_htlc__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void update_fail_htlc__free_unpacked - (UpdateFailHtlc *message, - ProtobufCAllocator *allocator); -/* UpdateFee methods */ -void update_fee__init - (UpdateFee *message); -size_t update_fee__get_packed_size - (const UpdateFee *message); -size_t update_fee__pack - (const UpdateFee *message, - uint8_t *out); -size_t update_fee__pack_to_buffer - (const UpdateFee *message, - ProtobufCBuffer *buffer); -UpdateFee * - update_fee__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void update_fee__free_unpacked - (UpdateFee *message, - ProtobufCAllocator *allocator); -/* UpdateCommit methods */ -void update_commit__init - (UpdateCommit *message); -size_t update_commit__get_packed_size - (const UpdateCommit *message); -size_t update_commit__pack - (const UpdateCommit *message, - uint8_t *out); -size_t update_commit__pack_to_buffer - (const UpdateCommit *message, - ProtobufCBuffer *buffer); -UpdateCommit * - update_commit__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void update_commit__free_unpacked - (UpdateCommit *message, - ProtobufCAllocator *allocator); -/* UpdateRevocation methods */ -void update_revocation__init - (UpdateRevocation *message); -size_t update_revocation__get_packed_size - (const UpdateRevocation *message); -size_t update_revocation__pack - (const UpdateRevocation *message, - uint8_t *out); -size_t update_revocation__pack_to_buffer - (const UpdateRevocation *message, - ProtobufCBuffer *buffer); -UpdateRevocation * - update_revocation__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void update_revocation__free_unpacked - (UpdateRevocation *message, - ProtobufCAllocator *allocator); -/* CloseShutdown methods */ -void close_shutdown__init - (CloseShutdown *message); -size_t close_shutdown__get_packed_size - (const CloseShutdown *message); -size_t close_shutdown__pack - (const CloseShutdown *message, - uint8_t *out); -size_t close_shutdown__pack_to_buffer - (const CloseShutdown *message, - ProtobufCBuffer *buffer); -CloseShutdown * - close_shutdown__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void close_shutdown__free_unpacked - (CloseShutdown *message, - ProtobufCAllocator *allocator); -/* CloseSignature methods */ -void close_signature__init - (CloseSignature *message); -size_t close_signature__get_packed_size - (const CloseSignature *message); -size_t close_signature__pack - (const CloseSignature *message, - uint8_t *out); -size_t close_signature__pack_to_buffer - (const CloseSignature *message, - ProtobufCBuffer *buffer); -CloseSignature * - close_signature__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void close_signature__free_unpacked - (CloseSignature *message, - ProtobufCAllocator *allocator); -/* Error methods */ -void error__init - (Error *message); -size_t error__get_packed_size - (const Error *message); -size_t error__pack - (const Error *message, - uint8_t *out); -size_t error__pack_to_buffer - (const Error *message, - ProtobufCBuffer *buffer); -Error * - error__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void error__free_unpacked - (Error *message, - ProtobufCAllocator *allocator); -/* NestedPkt methods */ -void nested_pkt__init - (NestedPkt *message); -size_t nested_pkt__get_packed_size - (const NestedPkt *message); -size_t nested_pkt__pack - (const NestedPkt *message, - uint8_t *out); -size_t nested_pkt__pack_to_buffer - (const NestedPkt *message, - ProtobufCBuffer *buffer); -NestedPkt * - nested_pkt__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void nested_pkt__free_unpacked - (NestedPkt *message, - ProtobufCAllocator *allocator); -/* Pkt methods */ -void pkt__init - (Pkt *message); -size_t pkt__get_packed_size - (const Pkt *message); -size_t pkt__pack - (const Pkt *message, - uint8_t *out); -size_t pkt__pack_to_buffer - (const Pkt *message, - ProtobufCBuffer *buffer); -Pkt * - pkt__unpack - (ProtobufCAllocator *allocator, - size_t len, - const uint8_t *data); -void pkt__free_unpacked - (Pkt *message, - ProtobufCAllocator *allocator); -/* --- per-message closures --- */ - -typedef void (*Sha256Hash_Closure) - (const Sha256Hash *message, - void *closure_data); -typedef void (*Preimage_Closure) - (const Preimage *message, - void *closure_data); -typedef void (*Signature_Closure) - (const Signature *message, - void *closure_data); -typedef void (*Locktime_Closure) - (const Locktime *message, - void *closure_data); -typedef void (*BitcoinPubkey_Closure) - (const BitcoinPubkey *message, - void *closure_data); -typedef void (*Funding_Closure) - (const Funding *message, - void *closure_data); -typedef void (*Authenticate_Closure) - (const Authenticate *message, - void *closure_data); -typedef void (*Init_Closure) - (const Init *message, - void *closure_data); -typedef void (*OpenChannel_Closure) - (const OpenChannel *message, - void *closure_data); -typedef void (*OpenAnchor_Closure) - (const OpenAnchor *message, - void *closure_data); -typedef void (*OpenCommitSig_Closure) - (const OpenCommitSig *message, - void *closure_data); -typedef void (*OpenComplete_Closure) - (const OpenComplete *message, - void *closure_data); -typedef void (*RouteStep_Closure) - (const RouteStep *message, - void *closure_data); -typedef void (*Route_Closure) - (const Route *message, - void *closure_data); -typedef void (*Routing_Closure) - (const Routing *message, - void *closure_data); -typedef void (*UpdateAddHtlc_Closure) - (const UpdateAddHtlc *message, - void *closure_data); -typedef void (*UpdateFulfillHtlc_Closure) - (const UpdateFulfillHtlc *message, - void *closure_data); -typedef void (*FailInfo_Closure) - (const FailInfo *message, - void *closure_data); -typedef void (*FailReason_Closure) - (const FailReason *message, - void *closure_data); -typedef void (*UpdateFailHtlc_Closure) - (const UpdateFailHtlc *message, - void *closure_data); -typedef void (*UpdateFee_Closure) - (const UpdateFee *message, - void *closure_data); -typedef void (*UpdateCommit_Closure) - (const UpdateCommit *message, - void *closure_data); -typedef void (*UpdateRevocation_Closure) - (const UpdateRevocation *message, - void *closure_data); -typedef void (*CloseShutdown_Closure) - (const CloseShutdown *message, - void *closure_data); -typedef void (*CloseSignature_Closure) - (const CloseSignature *message, - void *closure_data); -typedef void (*Error_Closure) - (const Error *message, - void *closure_data); -typedef void (*NestedPkt_Closure) - (const NestedPkt *message, - void *closure_data); -typedef void (*Pkt_Closure) - (const Pkt *message, - void *closure_data); - -/* --- services --- */ - - -/* --- descriptors --- */ - -extern const ProtobufCMessageDescriptor sha256_hash__descriptor; -extern const ProtobufCMessageDescriptor preimage__descriptor; -extern const ProtobufCMessageDescriptor signature__descriptor; -extern const ProtobufCMessageDescriptor locktime__descriptor; -extern const ProtobufCMessageDescriptor bitcoin_pubkey__descriptor; -extern const ProtobufCMessageDescriptor funding__descriptor; -extern const ProtobufCMessageDescriptor authenticate__descriptor; -extern const ProtobufCMessageDescriptor init__descriptor; -extern const ProtobufCMessageDescriptor open_channel__descriptor; -extern const ProtobufCEnumDescriptor open_channel__anchor_offer__descriptor; -extern const ProtobufCMessageDescriptor open_anchor__descriptor; -extern const ProtobufCMessageDescriptor open_commit_sig__descriptor; -extern const ProtobufCMessageDescriptor open_complete__descriptor; -extern const ProtobufCMessageDescriptor route_step__descriptor; -extern const ProtobufCMessageDescriptor route__descriptor; -extern const ProtobufCMessageDescriptor routing__descriptor; -extern const ProtobufCMessageDescriptor update_add_htlc__descriptor; -extern const ProtobufCMessageDescriptor update_fulfill_htlc__descriptor; -extern const ProtobufCMessageDescriptor fail_info__descriptor; -extern const ProtobufCMessageDescriptor fail_reason__descriptor; -extern const ProtobufCMessageDescriptor update_fail_htlc__descriptor; -extern const ProtobufCMessageDescriptor update_fee__descriptor; -extern const ProtobufCMessageDescriptor update_commit__descriptor; -extern const ProtobufCMessageDescriptor update_revocation__descriptor; -extern const ProtobufCMessageDescriptor close_shutdown__descriptor; -extern const ProtobufCMessageDescriptor close_signature__descriptor; -extern const ProtobufCMessageDescriptor error__descriptor; -extern const ProtobufCMessageDescriptor nested_pkt__descriptor; -extern const ProtobufCMessageDescriptor pkt__descriptor; - -PROTOBUF_C__END_DECLS - - -#endif /* PROTOBUF_C_lightning_2eproto__INCLUDED */ diff --git a/lightning.proto b/lightning.proto deleted file mode 100644 index 11596452f..000000000 --- a/lightning.proto +++ /dev/null @@ -1,262 +0,0 @@ -syntax = "proto2"; - -// The outer layer handles encryption, authentication and message -// boundaries. - -// -// Helper Types -// - -// Protobufs don't have fixed-length fields, so these are a hack. -message sha256_hash { - required fixed64 a = 1; - required fixed64 b = 2; - required fixed64 c = 3; - required fixed64 d = 4; -} - -message preimage { - required fixed64 a = 1; - required fixed64 b = 2; - required fixed64 c = 3; - required fixed64 d = 4; -} - -message signature { - required fixed64 r1 = 1; - required fixed64 r2 = 2; - required fixed64 r3 = 3; - required fixed64 r4 = 4; - required fixed64 s1 = 5; - required fixed64 s2 = 6; - required fixed64 s3 = 7; - required fixed64 s4 = 8; -} - -message locktime { - oneof locktime { - uint32 seconds = 1; - uint32 blocks = 2; - } -} - -// Pubkey for commitment transaction input. -message bitcoin_pubkey { - // Must be 33 bytes. - required bytes key = 1; -} - -// How much a node charges (or pays!) for sending. -message funding { - // Base amount (in satoshi). - optional int64 fixed = 1 [ default = 0 ]; - // This is charge per millionth of a satoshi. - optional int32 per_micro_satoshi = 2 [ default = 0 ]; -} - -// -// Packet Types -// - -// Set channel params. -message authenticate { - // Which node this is. - required bitcoin_pubkey node_id = 1; - // Signature of your session key. */ - required signature session_sig = 2; -}; - -// We're authenticated. Here's what we've received already. -message init { - // How many update_commit and update_revocation messages already received - required uint64 ack = 1; - // What features do we support (odd) and require (even) - optional bytes features = 2; -}; - -// Set channel params. -message open_channel { - // Relative locktime for outputs going to us. - required locktime delay = 1; - // Hash for revoking first commitment transaction. - required sha256_hash revocation_hash = 2; - // Hash for revoking second commitment transaction. - required sha256_hash next_revocation_hash = 8; - // Pubkey for anchor to pay into commitment tx. - required bitcoin_pubkey commit_key = 3; - // How to pay money to us from commit_tx. - required bitcoin_pubkey final_key = 4; - - enum anchor_offer { - // I will create the anchor - WILL_CREATE_ANCHOR = 1; - // I won't create the anchor - WONT_CREATE_ANCHOR = 2; - } - required anchor_offer anch = 5; - - // How far must anchor be buried before we consider channel live? - optional uint32 min_depth = 6 [ default = 0 ]; - - // How much fee would I like on commitment tx? - required uint64 initial_fee_rate = 7; -} - -// Whoever is supplying anchor sends this. -message open_anchor { - // Transaction ID of anchor. - required sha256_hash txid = 1; - // Which output is going to the 2 of 2. - required uint32 output_index = 2; - // Amount of anchor output. - required uint64 amount = 3; -} - -// Reply: signature for your initial commitment tx -message open_commit_sig { - required signature sig = 1; -} - -// Indicates we've seen anchor reach min-depth. -message open_complete { - // Block it went into. - optional sha256_hash blockid = 1; - // FIXME: add a merkle proof plus block headers here? -} - -message route_step { - // Where to next? - oneof next { - // Actually, this is the last one - bool end = 1; - // Next lightning node. - bitcoin_pubkey bitcoin = 2; - // Other realms go here... - } - - // How much to forward (difference is fee) - required uint32 amount = 4; -}; - -message route { - repeated route_step steps = 1; -}; - -message routing { - required bytes info = 1; -} - -// Start a new commitment tx to add an HTLC me -> you. -message update_add_htlc { - // Unique identifier for this HTLC. - required uint64 id = 1; - // Amount for htlc (millisatoshi) - required uint32 amount_msat = 2; - // Hash for HTLC R value. - required sha256_hash r_hash = 3; - // Time at which HTLC expires (absolute) - required locktime expiry = 4; - // Onion-wrapped routing information. - required routing route = 5; -} - -// Complete your HTLC: I have the R value, pay me! -message update_fulfill_htlc { - // Which HTLC - required uint64 id = 1; - // HTLC payment_preimage. - required preimage r = 2; -} - -// This is encrypted in fail_reason. -message fail_info { - required bitcoin_pubkey id = 1; - required uint32 error_code = 2; - optional string reason = 3; -} - -message fail_reason { - required bytes info = 1; -} - -message update_fail_htlc { - // Which HTLC - required uint64 id = 1; - // Reason for failure (for relay to initial node) - required fail_reason reason = 2; -} - -// Fee rate change proposal -message update_fee { - required uint32 fee_rate = 1; -} - -// Commit all the staged changes. -message update_commit { - // Signature for your new commitment tx (if any outputs are HTLCs or to you) - optional signature sig = 1; -} - -// Complete the update. -message update_revocation { - // Hash preimage which revokes old commitment tx. - required sha256_hash revocation_preimage = 1; - // Revocation hash for my next commit transaction - required sha256_hash next_revocation_hash = 2; -} - -// Start clearing out the channel HTLCs so we can close it -message close_shutdown { - // Output script for mutual close tx. - required bytes scriptPubkey = 1; -} - -message close_signature { - // Fee in satoshis. - required uint64 close_fee = 1; - // Signature on the close transaction. - required signature sig = 2; -} - -// This means we're going to hang up; it's to help diagnose only! -message error { - optional string problem = 1; -} - -// Nested message to transport standard protocol messages through the legacy transport -message nested_pkt { - required uint32 type = 1; - required bytes inner_pkt = 2; -} - -// This is the union which defines all of them -message pkt { - oneof pkt { - // Start of connection - authenticate auth = 50; - init init = 51; - - // Opening - open_channel open = 20; - open_anchor open_anchor = 21; - open_commit_sig open_commit_sig = 22; - open_complete open_complete = 23; - // Updating (most common) - update_add_htlc update_add_htlc = 2; - update_fulfill_htlc update_fulfill_htlc = 3; - update_fail_htlc update_fail_htlc = 4; - update_fee update_fee = 5; - update_commit update_commit = 6; - update_revocation update_revocation = 7; - - // Closing - close_shutdown close_shutdown = 30; - close_signature close_signature = 31; - - // Unexpected issue. - error error = 40; - - // Shim to upgrade to new packet format - nested_pkt nested = 128; - } -} diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 3fab3401a..06c92557a 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -88,14 +88,6 @@ bool db_remove_invoice(struct lightningd_state *dstate, return true; } - #include -void queue_pkt_nested(struct peer *peer, - int type, - const u8 *nested_pkt) -{ - FIXME_IMPLEMENT(); -} - static struct lightningd *new_lightningd(const tal_t *ctx) { struct lightningd *ld = tal(ctx, struct lightningd); diff --git a/protobuf_convert.c b/protobuf_convert.c deleted file mode 100644 index edfdff28e..000000000 --- a/protobuf_convert.c +++ /dev/null @@ -1,206 +0,0 @@ -#include "bitcoin/locktime.h" -#include "bitcoin/preimage.h" -#include "bitcoin/pubkey.h" -#include "bitcoin/signature.h" -#include "protobuf_convert.h" -#include "type_to_string.h" -#include "utils.h" -#include - -Signature *signature_to_proto(const tal_t *ctx, const secp256k1_ecdsa_signature *sig) -{ - u8 compact[64]; - Signature *pb = tal(ctx, Signature); - signature__init(pb); - - assert(sig_valid(sig)); - - secp256k1_ecdsa_signature_serialize_compact(secp256k1_ctx, - compact, sig); - - /* Kill me now... */ - memcpy(&pb->r1, compact, 8); - memcpy(&pb->r2, compact + 8, 8); - memcpy(&pb->r3, compact + 16, 8); - memcpy(&pb->r4, compact + 24, 8); - memcpy(&pb->s1, compact + 32, 8); - memcpy(&pb->s2, compact + 40, 8); - memcpy(&pb->s3, compact + 48, 8); - memcpy(&pb->s4, compact + 56, 8); - - return pb; -} - -bool proto_to_signature(const Signature *pb, secp256k1_ecdsa_signature *sig) -{ - u8 compact[64]; - - /* Kill me again. */ - memcpy(compact, &pb->r1, 8); - memcpy(compact + 8, &pb->r2, 8); - memcpy(compact + 16, &pb->r3, 8); - memcpy(compact + 24, &pb->r4, 8); - memcpy(compact + 32, &pb->s1, 8); - memcpy(compact + 40, &pb->s2, 8); - memcpy(compact + 48, &pb->s3, 8); - memcpy(compact + 56, &pb->s4, 8); - - if (secp256k1_ecdsa_signature_parse_compact(secp256k1_ctx, - sig, compact) - != 1) - return false; - - return sig_valid(sig); -} - -BitcoinPubkey *pubkey_to_proto(const tal_t *ctx, const struct pubkey *key) -{ - BitcoinPubkey *p = tal(ctx, BitcoinPubkey); - - bitcoin_pubkey__init(p); - p->key.len = PUBKEY_DER_LEN; - p->key.data = tal_arr(p, u8, p->key.len); - - pubkey_to_der(p->key.data, key); - - return p; -} - -bool proto_to_pubkey(const BitcoinPubkey *pb, struct pubkey *key) -{ - return pubkey_from_der(pb->key.data, pb->key.len, key); -} - -Sha256Hash *sha256_to_proto(const tal_t *ctx, const struct sha256 *hash) -{ - Sha256Hash *h = tal(ctx, Sha256Hash); - sha256_hash__init(h); - - /* Kill me now... */ - memcpy(&h->a, hash->u.u8, 8); - memcpy(&h->b, hash->u.u8 + 8, 8); - memcpy(&h->c, hash->u.u8 + 16, 8); - memcpy(&h->d, hash->u.u8 + 24, 8); - return h; -} - -void proto_to_sha256(const Sha256Hash *pb, struct sha256 *hash) -{ - /* Kill me again. */ - memcpy(hash->u.u8, &pb->a, 8); - memcpy(hash->u.u8 + 8, &pb->b, 8); - memcpy(hash->u.u8 + 16, &pb->c, 8); - memcpy(hash->u.u8 + 24, &pb->d, 8); -} - -Preimage *preimage_to_proto(const tal_t *ctx, const struct preimage *r) -{ - Preimage *pb = tal(ctx, Preimage); - preimage__init(pb); - - /* Kill me now... */ - memcpy(&pb->a, r->r, 8); - memcpy(&pb->b, r->r + 8, 8); - memcpy(&pb->c, r->r + 16, 8); - memcpy(&pb->d, r->r + 24, 8); - return pb; -} - -void proto_to_preimage(const Preimage *pb, struct preimage *r) -{ - /* Kill me again. */ - memcpy(r->r, &pb->a, 8); - memcpy(r->r + 8, &pb->b, 8); - memcpy(r->r + 16, &pb->c, 8); - memcpy(r->r + 24, &pb->d, 8); -} - - -bool proto_to_rel_locktime(const Locktime *l, struct rel_locktime *locktime) -{ - switch (l->locktime_case) { - case LOCKTIME__LOCKTIME_SECONDS: - return seconds_to_rel_locktime(l->seconds, locktime); - case LOCKTIME__LOCKTIME_BLOCKS: - return blocks_to_rel_locktime(l->blocks, locktime); - default: - return false; - } -} - -bool proto_to_abs_locktime(const Locktime *l, struct abs_locktime *locktime) -{ - switch (l->locktime_case) { - case LOCKTIME__LOCKTIME_SECONDS: - return seconds_to_abs_locktime(l->seconds, locktime); - case LOCKTIME__LOCKTIME_BLOCKS: - return blocks_to_abs_locktime(l->blocks, locktime); - default: - return false; - } -} - -Locktime *rel_locktime_to_proto(const tal_t *ctx, - const struct rel_locktime *locktime) -{ - Locktime *l = tal(ctx, Locktime); - locktime__init(l); - - if (rel_locktime_is_seconds(locktime)) { - l->locktime_case = LOCKTIME__LOCKTIME_SECONDS; - l->seconds = rel_locktime_to_seconds(locktime); - } else { - l->locktime_case = LOCKTIME__LOCKTIME_BLOCKS; - l->blocks = rel_locktime_to_blocks(locktime); - } - return l; -} - -Locktime *abs_locktime_to_proto(const tal_t *ctx, - const struct abs_locktime *locktime) -{ - Locktime *l = tal(ctx, Locktime); - locktime__init(l); - - if (abs_locktime_is_seconds(locktime)) { - l->locktime_case = LOCKTIME__LOCKTIME_SECONDS; - l->seconds = abs_locktime_to_seconds(locktime); - } else { - l->locktime_case = LOCKTIME__LOCKTIME_BLOCKS; - l->blocks = abs_locktime_to_blocks(locktime); - } - return l; -} - -static void *proto_tal_alloc(void *allocator_data, size_t size) -{ - return tal_arr(allocator_data, char, size); -} - -static void proto_tal_free(void *allocator_data, void *pointer) -{ - tal_free(pointer); -} - -/* Get allocator so decoded protobuf will be tal off it. */ -struct ProtobufCAllocator *make_prototal(const tal_t *ctx) -{ - struct ProtobufCAllocator *prototal; - - prototal = tal(ctx, struct ProtobufCAllocator); - prototal->alloc = proto_tal_alloc; - prototal->free = proto_tal_free; - prototal->allocator_data = tal(prototal, char); - - return prototal; -} - -/* Now steal object off of allocator (and free prototal) */ -void steal_from_prototal(const tal_t *ctx, struct ProtobufCAllocator *prototal, - const void *pb) -{ - tal_steal(ctx, pb); - tal_steal(pb, prototal->allocator_data); - tal_free(prototal); -} -REGISTER_TYPE_TO_HEXSTR(preimage); diff --git a/protobuf_convert.h b/protobuf_convert.h deleted file mode 100644 index 29b840957..000000000 --- a/protobuf_convert.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef LIGHTNING_PROTOBUF_CONVERT_H -#define LIGHTNING_PROTOBUF_CONVERT_H -#include "config.h" -#include "lightning.pb-c.h" -#include -#include -#include - -/* Convert to-from protobuf to internal representation. */ -Signature *signature_to_proto(const tal_t *ctx, - const secp256k1_ecdsa_signature *sig); -bool proto_to_signature(const Signature *pb, - secp256k1_ecdsa_signature *sig); - -/* Convert to-from protobuf to internal representation. */ -struct pubkey; -BitcoinPubkey *pubkey_to_proto(const tal_t *ctx, - const struct pubkey *key); -bool proto_to_pubkey(const BitcoinPubkey *pb, struct pubkey *key); - -/* Useful helper for allocating & populating a protobuf Sha256Hash */ -struct sha256; -Sha256Hash *sha256_to_proto(const tal_t *ctx, const struct sha256 *hash); -void proto_to_sha256(const Sha256Hash *pb, struct sha256 *hash); - -struct preimage; -Preimage *preimage_to_proto(const tal_t *ctx, const struct preimage *r); -void proto_to_preimage(const Preimage *pb, struct preimage *r); - -struct rel_locktime; -struct abs_locktime; -bool proto_to_rel_locktime(const Locktime *l, struct rel_locktime *locktime); -bool proto_to_abs_locktime(const Locktime *l, struct abs_locktime *locktime); -Locktime *rel_locktime_to_proto(const tal_t *ctx, - const struct rel_locktime *locktime); -Locktime *abs_locktime_to_proto(const tal_t *ctx, - const struct abs_locktime *locktime); - -/* Get allocator so decoded protobuf will be tal off it. */ -struct ProtobufCAllocator *make_prototal(const tal_t *ctx); -/* Now steal object off of allocator (and free prototal) */ -void steal_from_prototal(const tal_t *ctx, struct ProtobufCAllocator *prototal, - const void *pb); - -#endif /* LIGHTNING_PROTOBUF_CONVERT_H */ diff --git a/type_to_string.c b/type_to_string.c index 7e52bb0a5..6426084b3 100644 --- a/type_to_string.c +++ b/type_to_string.c @@ -2,7 +2,6 @@ #include "bitcoin/pubkey.h" #include "bitcoin/tx.h" #include "daemon/htlc.h" -#include "protobuf_convert.h" #include "type_to_string.h" #include "utils.h" #include