mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
Makefile: use generic rules to make spec-derived sources.
Now we use the same Makefile rules for all CSV->C generation. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
a00179d557
commit
8150d28575
8
Makefile
8
Makefile
@@ -263,6 +263,12 @@ SHA256STAMP = echo '$(2) SHA256STAMP:$(1)'`cat $^ | sha256sum | cut -c1-64` >> $
|
|||||||
%_wiregen.c: %_wire.csv $(WIRE_GEN_DEPS)
|
%_wiregen.c: %_wire.csv $(WIRE_GEN_DEPS)
|
||||||
@if $(call SHA256STAMP_CHANGED,exp-$(EXPERIMENTAL_FEATURES)-); then $(call VERBOSE,"wiregen $@",tools/generate-wire.py --page impl $($@_args) ${@:.c=.h} `basename $< .csv` < $< > $@ && $(call SHA256STAMP,exp-$(EXPERIMENTAL_FEATURES)-,//)); fi
|
@if $(call SHA256STAMP_CHANGED,exp-$(EXPERIMENTAL_FEATURES)-); then $(call VERBOSE,"wiregen $@",tools/generate-wire.py --page impl $($@_args) ${@:.c=.h} `basename $< .csv` < $< > $@ && $(call SHA256STAMP,exp-$(EXPERIMENTAL_FEATURES)-,//)); fi
|
||||||
|
|
||||||
|
%_printgen.h: %_wire.csv $(WIRE_GEN_DEPS)
|
||||||
|
@if $(call SHA256STAMP_CHANGED,exp-$(EXPERIMENTAL_FEATURES)-); then $(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page header $($@_args) $@ `basename $< .csv` < $< > $@ && $(call SHA256STAMP,exp-$(EXPERIMENTAL_FEATURES)-,//)); fi
|
||||||
|
|
||||||
|
%_printgen.c: %_wire.csv $(WIRE_GEN_DEPS)
|
||||||
|
@if $(call SHA256STAMP_CHANGED,exp-$(EXPERIMENTAL_FEATURES)-); then $(call VERBOSE,"printgen $@",tools/generate-wire.py -s -P --page impl $($@_args) ${@:.c=.h} `basename $< .csv` < $< > $@ && $(call SHA256STAMP,exp-$(EXPERIMENTAL_FEATURES)-,//)); fi
|
||||||
|
|
||||||
include external/Makefile
|
include external/Makefile
|
||||||
include bitcoin/Makefile
|
include bitcoin/Makefile
|
||||||
include common/Makefile
|
include common/Makefile
|
||||||
@@ -485,7 +491,7 @@ clean:
|
|||||||
$(RM) $(CCAN_OBJS) $(CDUMP_OBJS) $(ALL_OBJS)
|
$(RM) $(CCAN_OBJS) $(CDUMP_OBJS) $(ALL_OBJS)
|
||||||
$(RM) $(ALL_PROGRAMS) $(ALL_PROGRAMS:=.o)
|
$(RM) $(ALL_PROGRAMS) $(ALL_PROGRAMS:=.o)
|
||||||
$(RM) $(ALL_TEST_PROGRAMS) $(ALL_TEST_PROGRAMS:=.o)
|
$(RM) $(ALL_TEST_PROGRAMS) $(ALL_TEST_PROGRAMS:=.o)
|
||||||
$(RM) gen_*.h ccan/tools/configurator/configurator
|
$(RM) gen_*.h */gen_* ccan/tools/configurator/configurator
|
||||||
$(RM) ccan/ccan/cdump/tools/cdump-enumstr.o
|
$(RM) ccan/ccan/cdump/tools/cdump-enumstr.o
|
||||||
find . -name '*gcda' -delete
|
find . -name '*gcda' -delete
|
||||||
find . -name '*gcno' -delete
|
find . -name '*gcno' -delete
|
||||||
|
|||||||
@@ -127,6 +127,6 @@ check-whitespace: $(LIGHTNINGD_CHANNEL_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNI
|
|||||||
clean: lightningd/channel-clean
|
clean: lightningd/channel-clean
|
||||||
|
|
||||||
lightningd/channel-clean:
|
lightningd/channel-clean:
|
||||||
$(RM) $(LIGHTNINGD_CHANNEL_OBJS) channeld/gen_*
|
$(RM) $(LIGHTNINGD_CHANNEL_OBJS)
|
||||||
|
|
||||||
-include channeld/test/Makefile
|
-include channeld/test/Makefile
|
||||||
|
|||||||
@@ -62,8 +62,8 @@
|
|||||||
#include <secp256k1.h>
|
#include <secp256k1.h>
|
||||||
#include <sodium/crypto_aead_chacha20poly1305.h>
|
#include <sodium/crypto_aead_chacha20poly1305.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wire/gen_common_wire.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
#include <wire/peer_wire.h>
|
#include <wire/peer_wire.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
#include <wire/wire_io.h>
|
#include <wire/wire_io.h>
|
||||||
@@ -1736,8 +1736,8 @@ static void handle_peer_shutdown(struct peer *peer, const u8 *shutdown)
|
|||||||
static bool channeld_handle_custommsg(const u8 *msg)
|
static bool channeld_handle_custommsg(const u8 *msg)
|
||||||
{
|
{
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
enum wire_type type = fromwire_peektype(msg);
|
enum peer_wire type = fromwire_peektype(msg);
|
||||||
if (type % 2 == 1 && !wire_type_is_defined(type)) {
|
if (type % 2 == 1 && !peer_wire_is_defined(type)) {
|
||||||
/* The message is not part of the messages we know how to
|
/* The message is not part of the messages we know how to
|
||||||
* handle. Assuming this is a custommsg, we just forward it to the
|
* handle. Assuming this is a custommsg, we just forward it to the
|
||||||
* master. */
|
* master. */
|
||||||
@@ -1755,7 +1755,7 @@ static bool channeld_handle_custommsg(const u8 *msg)
|
|||||||
/* Peer sends onion msg. */
|
/* Peer sends onion msg. */
|
||||||
static void handle_onion_message(struct peer *peer, const u8 *msg)
|
static void handle_onion_message(struct peer *peer, const u8 *msg)
|
||||||
{
|
{
|
||||||
enum onion_type badreason;
|
enum onion_wire badreason;
|
||||||
struct onionpacket op;
|
struct onionpacket op;
|
||||||
struct secret ss, *blinding_ss;
|
struct secret ss, *blinding_ss;
|
||||||
struct pubkey *blinding_in;
|
struct pubkey *blinding_in;
|
||||||
@@ -1775,7 +1775,7 @@ static void handle_onion_message(struct peer *peer, const u8 *msg)
|
|||||||
badreason = parse_onionpacket(onion, TOTAL_PACKET_SIZE, &op);
|
badreason = parse_onionpacket(onion, TOTAL_PACKET_SIZE, &op);
|
||||||
if (badreason != 0) {
|
if (badreason != 0) {
|
||||||
status_debug("onion msg: can't parse onionpacket: %s",
|
status_debug("onion msg: can't parse onionpacket: %s",
|
||||||
onion_type_name(badreason));
|
onion_wire_name(badreason));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2031,7 +2031,7 @@ static void handle_unexpected_reestablish(struct peer *peer, const u8 *msg)
|
|||||||
|
|
||||||
static void peer_in(struct peer *peer, const u8 *msg)
|
static void peer_in(struct peer *peer, const u8 *msg)
|
||||||
{
|
{
|
||||||
enum wire_type type = fromwire_peektype(msg);
|
enum peer_wire type = fromwire_peektype(msg);
|
||||||
|
|
||||||
/* Only count soft errors if the channel has locked-in already;
|
/* Only count soft errors if the channel has locked-in already;
|
||||||
* otherwise we can't cancel a channel before it has opened.
|
* otherwise we can't cancel a channel before it has opened.
|
||||||
@@ -2065,7 +2065,7 @@ static void peer_in(struct peer *peer, const u8 *msg)
|
|||||||
peer_failed(peer->pps,
|
peer_failed(peer->pps,
|
||||||
&peer->channel_id,
|
&peer->channel_id,
|
||||||
"%s (%u) before funding locked",
|
"%s (%u) before funding locked",
|
||||||
wire_type_name(type), type);
|
peer_wire_name(type), type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2136,7 +2136,7 @@ static void peer_in(struct peer *peer, const u8 *msg)
|
|||||||
peer_failed(peer->pps,
|
peer_failed(peer->pps,
|
||||||
&peer->channel_id,
|
&peer->channel_id,
|
||||||
"Peer sent unknown message %u (%s)",
|
"Peer sent unknown message %u (%s)",
|
||||||
type, wire_type_name(type));
|
type, peer_wire_name(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void resend_revoke(struct peer *peer)
|
static void resend_revoke(struct peer *peer)
|
||||||
@@ -2475,7 +2475,7 @@ static bool capture_premature_msg(const u8 ***shit_lnd_says, const u8 *msg)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
status_debug("Stashing early %s msg!",
|
status_debug("Stashing early %s msg!",
|
||||||
wire_type_name(fromwire_peektype(msg)));
|
peer_wire_name(fromwire_peektype(msg)));
|
||||||
|
|
||||||
tal_arr_expand(shit_lnd_says, tal_steal(*shit_lnd_says, msg));
|
tal_arr_expand(shit_lnd_says, tal_steal(*shit_lnd_says, msg));
|
||||||
return true;
|
return true;
|
||||||
@@ -2583,7 +2583,7 @@ static void peer_reconnect(struct peer *peer,
|
|||||||
peer_failed(peer->pps,
|
peer_failed(peer->pps,
|
||||||
&peer->channel_id,
|
&peer->channel_id,
|
||||||
"bad reestablish msg: %s %s",
|
"bad reestablish msg: %s %s",
|
||||||
wire_type_name(fromwire_peektype(msg)),
|
peer_wire_name(fromwire_peektype(msg)),
|
||||||
tal_hex(msg, msg));
|
tal_hex(msg, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3162,7 +3162,7 @@ static void req_in(struct peer *peer, const u8 *msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now handle common messages. */
|
/* Now handle common messages. */
|
||||||
switch ((enum common_wire_type)t) {
|
switch ((enum common_wire)t) {
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
case WIRE_CUSTOMMSG_OUT:
|
case WIRE_CUSTOMMSG_OUT:
|
||||||
channeld_send_custommsg(peer, msg);
|
channeld_send_custommsg(peer, msg);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <common/amount.h>
|
#include <common/amount.h>
|
||||||
#include <common/htlc.h>
|
#include <common/htlc.h>
|
||||||
#include <common/pseudorand.h>
|
#include <common/pseudorand.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct htlc {
|
struct htlc {
|
||||||
/* What's the status. */
|
/* What's the status. */
|
||||||
|
|||||||
@@ -96,6 +96,6 @@ check-whitespace: $(LIGHTNINGD_CLOSING_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNI
|
|||||||
clean: closingd-clean
|
clean: closingd-clean
|
||||||
|
|
||||||
closingd-clean:
|
closingd-clean:
|
||||||
$(RM) $(LIGHTNINGD_CLOSING_OBJS) closingd/gen_*
|
$(RM) $(LIGHTNINGD_CLOSING_OBJS)
|
||||||
|
|
||||||
-include closingd/test/Makefile
|
-include closingd/test/Makefile
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ static void do_reconnect(struct per_peer_state *pps,
|
|||||||
&next_commitment_point)) {
|
&next_commitment_point)) {
|
||||||
peer_failed(pps, channel_id,
|
peer_failed(pps, channel_id,
|
||||||
"bad reestablish msg: %s %s",
|
"bad reestablish msg: %s %s",
|
||||||
wire_type_name(fromwire_peektype(channel_reestablish)),
|
peer_wire_name(fromwire_peektype(channel_reestablish)),
|
||||||
tal_hex(tmpctx, channel_reestablish));
|
tal_hex(tmpctx, channel_reestablish));
|
||||||
}
|
}
|
||||||
status_debug("Got reestablish commit=%"PRIu64" revoke=%"PRIu64,
|
status_debug("Got reestablish commit=%"PRIu64" revoke=%"PRIu64,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <ccan/cast/cast.h>
|
#include <ccan/cast/cast.h>
|
||||||
#include <common/decode_array.h>
|
#include <common/decode_array.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
/* We move the fd if and only if we do a disconnect. */
|
/* We move the fd if and only if we do a disconnect. */
|
||||||
@@ -71,7 +71,7 @@ enum dev_disconnect dev_disconnect(int pkt_type)
|
|||||||
if (!dev_disconnect_count)
|
if (!dev_disconnect_count)
|
||||||
next_dev_disconnect();
|
next_dev_disconnect();
|
||||||
|
|
||||||
if (!streq(wire_type_name(pkt_type), dev_disconnect_line+1))
|
if (!streq(peer_wire_name(pkt_type), dev_disconnect_line+1))
|
||||||
return DEV_DISCONNECT_NORMAL;
|
return DEV_DISCONNECT_NORMAL;
|
||||||
|
|
||||||
if (--dev_disconnect_count != 0) {
|
if (--dev_disconnect_count != 0) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <common/gossip_rcvd_filter.h>
|
#include <common/gossip_rcvd_filter.h>
|
||||||
#include <common/memleak.h>
|
#include <common/memleak.h>
|
||||||
#include <common/pseudorand.h>
|
#include <common/pseudorand.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
static u64 msg_key(const u8 *msg)
|
static u64 msg_key(const u8 *msg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
void gossip_setup_timestamp_filter(struct per_peer_state *pps,
|
void gossip_setup_timestamp_filter(struct per_peer_state *pps,
|
||||||
u32 first_timestamp,
|
u32 first_timestamp,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
/* We need this global to decode indexes for hash functions */
|
/* We need this global to decode indexes for hash functions */
|
||||||
static struct gossmap *map;
|
static struct gossmap *map;
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ void fromwire_fulfilled_htlc(const u8 **cursor, size_t *max,
|
|||||||
struct failed_htlc *fromwire_failed_htlc(const tal_t *ctx, const u8 **cursor, size_t *max)
|
struct failed_htlc *fromwire_failed_htlc(const tal_t *ctx, const u8 **cursor, size_t *max)
|
||||||
{
|
{
|
||||||
struct failed_htlc *failed = tal(ctx, struct failed_htlc);
|
struct failed_htlc *failed = tal(ctx, struct failed_htlc);
|
||||||
enum onion_type badonion;
|
enum onion_wire badonion;
|
||||||
|
|
||||||
failed->id = fromwire_u64(cursor, max);
|
failed->id = fromwire_u64(cursor, max);
|
||||||
badonion = fromwire_u16(cursor, max);
|
badonion = fromwire_u16(cursor, max);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <common/amount.h>
|
#include <common/amount.h>
|
||||||
#include <common/htlc.h>
|
#include <common/htlc.h>
|
||||||
#include <common/sphinx.h>
|
#include <common/sphinx.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct bitcoin_tx;
|
struct bitcoin_tx;
|
||||||
struct shachain;
|
struct shachain;
|
||||||
@@ -54,7 +54,7 @@ struct failed_htlc {
|
|||||||
struct sha256 *sha256_of_onion;
|
struct sha256 *sha256_of_onion;
|
||||||
/* WIRE_INVALID_ONION_VERSION, WIRE_INVALID_ONION_KEY or
|
/* WIRE_INVALID_ONION_VERSION, WIRE_INVALID_ONION_KEY or
|
||||||
* WIRE_INVALID_ONION_HMAC (ie. must have BADONION) */
|
* WIRE_INVALID_ONION_HMAC (ie. must have BADONION) */
|
||||||
enum onion_type badonion;
|
enum onion_wire badonion;
|
||||||
|
|
||||||
/* Otherwise, this is the onion ready to send to them. */
|
/* Otherwise, this is the onion ready to send to them. */
|
||||||
const struct onionreply *onion;
|
const struct onionreply *onion;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <common/ecdh.h>
|
#include <common/ecdh.h>
|
||||||
#include <common/sphinx.h>
|
#include <common/sphinx.h>
|
||||||
#include <sodium/crypto_aead_chacha20poly1305.h>
|
#include <sodium/crypto_aead_chacha20poly1305.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
/* BOLT #4:
|
/* BOLT #4:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <common/ping.h>
|
#include <common/ping.h>
|
||||||
#include <common/status.h>
|
#include <common/status.h>
|
||||||
#include <common/version.h>
|
#include <common/version.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong)
|
bool check_ping_make_pong(const tal_t *ctx, const u8 *ping, u8 **pong)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps,
|
|||||||
/* They're talking about a different channel? */
|
/* They're talking about a different channel? */
|
||||||
if (is_wrong_channel(msg, channel_id, &actual)) {
|
if (is_wrong_channel(msg, channel_id, &actual)) {
|
||||||
status_debug("Rejecting %s for unknown channel_id %s",
|
status_debug("Rejecting %s for unknown channel_id %s",
|
||||||
wire_type_name(fromwire_peektype(msg)),
|
peer_wire_name(fromwire_peektype(msg)),
|
||||||
type_to_string(tmpctx, struct channel_id, &actual));
|
type_to_string(tmpctx, struct channel_id, &actual));
|
||||||
sync_crypto_write(pps,
|
sync_crypto_write(pps,
|
||||||
take(towire_errorfmt(NULL, &actual,
|
take(towire_errorfmt(NULL, &actual,
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ u8 *serialize_onionpacket(
|
|||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum onion_type parse_onionpacket(const u8 *src,
|
enum onion_wire parse_onionpacket(const u8 *src,
|
||||||
const size_t srclen,
|
const size_t srclen,
|
||||||
struct onionpacket *dest)
|
struct onionpacket *dest)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <common/hmac.h>
|
#include <common/hmac.h>
|
||||||
#include <secp256k1.h>
|
#include <secp256k1.h>
|
||||||
#include <sodium/randombytes.h>
|
#include <sodium/randombytes.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct node_id;
|
struct node_id;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ u8 *serialize_onionpacket(
|
|||||||
* @srclen: length of the @src (must be TOTAL_PACKET_SIZE)
|
* @srclen: length of the @src (must be TOTAL_PACKET_SIZE)
|
||||||
* @dest: the destination into which we should parse the packet
|
* @dest: the destination into which we should parse the packet
|
||||||
*/
|
*/
|
||||||
enum onion_type parse_onionpacket(const u8 *src,
|
enum onion_wire parse_onionpacket(const u8 *src,
|
||||||
const size_t srclen,
|
const size_t srclen,
|
||||||
struct onionpacket *dest);
|
struct onionpacket *dest);
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ static void status_peer_io_short(enum log_level iodir,
|
|||||||
{
|
{
|
||||||
status_peer_debug(peer, "%s %s",
|
status_peer_debug(peer, "%s %s",
|
||||||
iodir == LOG_IO_OUT ? "peer_out" : "peer_in",
|
iodir == LOG_IO_OUT ? "peer_out" : "peer_in",
|
||||||
wire_type_name(fromwire_peektype(p)));
|
peer_wire_name(fromwire_peektype(p)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void status_peer_io(enum log_level iodir,
|
void status_peer_io(enum log_level iodir,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ALL_TEST_PROGRAMS += $(COMMON_TEST_PROGRAMS)
|
|||||||
ALL_OBJS += $(COMMON_TEST_PROGRAMS:=.o)
|
ALL_OBJS += $(COMMON_TEST_PROGRAMS:=.o)
|
||||||
|
|
||||||
# Sphinx test wants to decode TLVs.
|
# Sphinx test wants to decode TLVs.
|
||||||
common/test/run-sphinx: wire/gen_onion_wire.o wire/towire.o wire/fromwire.o
|
common/test/run-sphinx: wire/onion_wiregen.o wire/towire.o wire/fromwire.o
|
||||||
|
|
||||||
common/test/run-param \
|
common/test/run-param \
|
||||||
common/test/run-json: \
|
common/test/run-json: \
|
||||||
@@ -25,7 +25,7 @@ common/test/run-json: \
|
|||||||
common/wireaddr.o \
|
common/wireaddr.o \
|
||||||
common/type_to_string.o \
|
common/type_to_string.o \
|
||||||
wire/fromwire.o \
|
wire/fromwire.o \
|
||||||
wire/gen_onion_wire.o \
|
wire/onion_wiregen.o \
|
||||||
wire/towire.o
|
wire/towire.o
|
||||||
|
|
||||||
update-mocks: $(COMMON_TEST_SRC:%=update-mocks/%)
|
update-mocks: $(COMMON_TEST_SRC:%=update-mocks/%)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <common/type_to_string.h>
|
#include <common/type_to_string.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <common/wire_error.h>
|
#include <common/wire_error.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
u8 *towire_errorfmtv(const tal_t *ctx,
|
u8 *towire_errorfmtv(const tal_t *ctx,
|
||||||
const struct channel_id *channel,
|
const struct channel_id *channel,
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ CONNECTD_COMMON_OBJS := \
|
|||||||
common/wire_error.o \
|
common/wire_error.o \
|
||||||
gossipd/gossipd_wiregen.o \
|
gossipd/gossipd_wiregen.o \
|
||||||
lightningd/gossip_msg.o \
|
lightningd/gossip_msg.o \
|
||||||
wire/gen_onion_wire.o
|
wire/onion_wiregen.o
|
||||||
|
|
||||||
$(LIGHTNINGD_CONNECT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONNECT_HEADERS)
|
$(LIGHTNINGD_CONNECT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONNECT_HEADERS)
|
||||||
|
|
||||||
|
|||||||
@@ -67,8 +67,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
|
||||||
#include <wire/peer_wire.h>
|
#include <wire/peer_wire.h>
|
||||||
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire_io.h>
|
#include <wire/wire_io.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
DEVTOOLS_SRC := devtools/gen_print_wire.c devtools/gen_print_onion_wire.c devtools/print_wire.c
|
|
||||||
DEVTOOLS_OBJS := $(DEVTOOLS_SRC:.c=.o)
|
|
||||||
DEVTOOLS := devtools/bolt11-cli devtools/decodemsg devtools/onion devtools/dump-gossipstore devtools/gossipwith devtools/create-gossipstore devtools/mkcommit devtools/mkfunding devtools/mkclose devtools/mkgossip devtools/mkencoded devtools/mkquery devtools/lightning-checkmessage devtools/topology devtools/route
|
DEVTOOLS := devtools/bolt11-cli devtools/decodemsg devtools/onion devtools/dump-gossipstore devtools/gossipwith devtools/create-gossipstore devtools/mkcommit devtools/mkfunding devtools/mkclose devtools/mkgossip devtools/mkencoded devtools/mkquery devtools/lightning-checkmessage devtools/topology devtools/route
|
||||||
ifeq ($(HAVE_SQLITE3),1)
|
ifeq ($(HAVE_SQLITE3),1)
|
||||||
DEVTOOLS += devtools/checkchannels
|
DEVTOOLS += devtools/checkchannels
|
||||||
@@ -40,45 +38,31 @@ DEVTOOLS_COMMON_OBJS := \
|
|||||||
common/utils.o \
|
common/utils.o \
|
||||||
common/version.o \
|
common/version.o \
|
||||||
common/wireaddr.o \
|
common/wireaddr.o \
|
||||||
wire/gen_onion_wire.o \
|
wire/onion_wiregen.o \
|
||||||
wire/gen_peer_wire.o
|
wire/peer_wiregen.o
|
||||||
|
|
||||||
devtools-all: $(DEVTOOLS)
|
devtools-all: $(DEVTOOLS)
|
||||||
|
|
||||||
devtools/gen_print_wire.h: $(DEVTOOL_BOLT_DEPS) wire/gen_peer_wire_csv
|
devtools/bolt11-cli: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o
|
||||||
$(BOLT_GEN) -P -s --page header $@ wire_type < wire/gen_peer_wire_csv > $@
|
|
||||||
|
|
||||||
devtools/gen_print_wire.c: $(DEVTOOL_BOLT_DEPS) wire/gen_peer_wire_csv
|
devtools/decodemsg: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/peer_printgen.o wire/onion_printgen.o devtools/print_wire.o devtools/decodemsg.o
|
||||||
$(BOLT_GEN) -P -s --page impl ${@:.c=.h} wire_type < wire/gen_peer_wire_csv > $@
|
|
||||||
|
|
||||||
devtools/gen_print_onion_wire.h: $(DEVTOOL_BOLT_DEPS) wire/gen_onion_wire_csv
|
devtools/dump-gossipstore: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/dump-gossipstore.o gossipd/gossip_store_wiregen.o
|
||||||
$(BOLT_GEN) -P -s --page header $@ onion_type < wire/gen_onion_wire_csv > $@
|
|
||||||
|
|
||||||
devtools/gen_print_onion_wire.c: $(DEVTOOL_BOLT_DEPS) wire/gen_onion_wire_csv
|
|
||||||
$(BOLT_GEN) -P -s --page impl ${@:.c=.h} onion_type < wire/gen_onion_wire_csv > $@
|
|
||||||
|
|
||||||
devtools/bolt11-cli: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/bolt11-cli.o
|
|
||||||
|
|
||||||
devtools/decodemsg: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/decodemsg.o
|
|
||||||
|
|
||||||
devtools/dump-gossipstore: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/dump-gossipstore.o gossipd/gossip_store_wiregen.o
|
|
||||||
|
|
||||||
devtools/dump-gossipstore.o: gossipd/gossip_store_wiregen.h
|
devtools/dump-gossipstore.o: gossipd/gossip_store_wiregen.h
|
||||||
|
|
||||||
devtools/create-gossipstore: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/create-gossipstore.o gossipd/gossip_store_wiregen.o
|
devtools/create-gossipstore: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/create-gossipstore.o gossipd/gossip_store_wiregen.o
|
||||||
devtools/create-gossipstore.o: gossipd/gossip_store_wiregen.h
|
devtools/create-gossipstore.o: gossipd/gossip_store_wiregen.h
|
||||||
|
|
||||||
devtools/onion.c: ccan/config.h
|
devtools/onion.c: ccan/config.h
|
||||||
|
|
||||||
devtools/onion: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) common/onion.o common/onionreply.o wire/fromwire.o wire/towire.o devtools/onion.o common/sphinx.o
|
devtools/onion: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) common/onion.o common/onionreply.o wire/fromwire.o wire/towire.o devtools/onion.o common/sphinx.o
|
||||||
|
|
||||||
devtools/blindedpath: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) common/blinding.o $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/blindedpath.o common/onion.o common/onionreply.o common/sphinx.o
|
devtools/blindedpath: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) common/blinding.o $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o devtools/blindedpath.o common/onion.o common/onionreply.o common/sphinx.o
|
||||||
|
|
||||||
devtools/gossipwith: $(DEVTOOLS_OBJS) $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/gen_peer_wire.o devtools/gossipwith.o common/cryptomsg.o common/cryptomsg.o common/crypto_sync.o
|
devtools/gossipwith: $(DEVTOOLS_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fromwire.o wire/towire.o wire/peer_wiregen.o devtools/gossipwith.o common/cryptomsg.o common/cryptomsg.o common/crypto_sync.o
|
||||||
|
|
||||||
$(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS): wire/wire.h devtools/gen_print_wire.h devtools/gen_print_onion_wire.h
|
$(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS): wire/wire.h
|
||||||
devtools/gen_print_wire.o: devtools/gen_print_wire.h wire/gen_peer_wire.h devtools/print_wire.h
|
|
||||||
devtools/gen_print_onion_wire.o: devtools/gen_print_onion_wire.h devtools/print_wire.h
|
|
||||||
|
|
||||||
devtools/mkcommit: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) common/derive_basepoints.o common/keyset.o common/key_derive.o common/initial_commit_tx.o common/permute_tx.o wire/fromwire.o wire/towire.o devtools/mkcommit.o channeld/full_channel.o common/initial_channel.o common/htlc_state.o common/pseudorand.o common/htlc_tx.o channeld/commit_tx.o common/htlc_trim.o
|
devtools/mkcommit: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) common/derive_basepoints.o common/keyset.o common/key_derive.o common/initial_commit_tx.o common/permute_tx.o wire/fromwire.o wire/towire.o devtools/mkcommit.o channeld/full_channel.o common/initial_channel.o common/htlc_state.o common/pseudorand.o common/htlc_tx.o channeld/commit_tx.o common/htlc_trim.o
|
||||||
|
|
||||||
@@ -102,11 +86,11 @@ devtools/topology: $(DEVTOOLS_COMMON_OBJS) $(CCAN_OBJS) $(BITCOIN_OBJS) wire/fro
|
|||||||
|
|
||||||
# Make sure these depend on everything.
|
# Make sure these depend on everything.
|
||||||
ALL_PROGRAMS += $(DEVTOOLS)
|
ALL_PROGRAMS += $(DEVTOOLS)
|
||||||
ALL_OBJS += $(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS)
|
ALL_OBJS += $(DEVTOOLS_TOOL_OBJS)
|
||||||
|
|
||||||
check-source: $(DEVTOOLS_SRC:%=check-src-include-order/%) $(DEVTOOLS_TOOLS_SRC:%=check-src-include-order/%)
|
check-source: $(DEVTOOLS_SRC:%=check-src-include-order/%) $(DEVTOOLS_TOOLS_SRC:%=check-src-include-order/%)
|
||||||
|
|
||||||
clean: devtools-clean
|
clean: devtools-clean
|
||||||
|
|
||||||
devtools-clean:
|
devtools-clean:
|
||||||
$(RM) $(DEVTOOLS_OBJS) $(DEVTOOLS_TOOL_OBJS) devtools/bolt11-cli devtools/decodemsg devtools/onion devtools/gen_print_wire.[c,h,o] devtools/gen_print_onion_wire.[c,h,o]
|
$(RM) $(DEVTOOLS_TOOL_OBJS) $(DEVTOOLS)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
|
|
||||||
struct scidsat {
|
struct scidsat {
|
||||||
@@ -175,7 +175,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
fprintf(stderr, "%s\n",
|
fprintf(stderr, "%s\n",
|
||||||
wire_type_name(fromwire_peektype(inmsg)));
|
peer_wire_name(fromwire_peektype(inmsg)));
|
||||||
|
|
||||||
switch (fromwire_peektype(inmsg)) {
|
switch (fromwire_peektype(inmsg)) {
|
||||||
case WIRE_CHANNEL_ANNOUNCEMENT:
|
case WIRE_CHANNEL_ANNOUNCEMENT:
|
||||||
@@ -242,7 +242,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
warnx("Unknown message %u (%s)", fromwire_peektype(inmsg),
|
warnx("Unknown message %u (%s)", fromwire_peektype(inmsg),
|
||||||
wire_type_name(fromwire_peektype(inmsg)));
|
peer_wire_name(fromwire_peektype(inmsg)));
|
||||||
tal_free(inmsg);
|
tal_free(inmsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
#include <ccan/tal/grab_file/grab_file.h>
|
#include <ccan/tal/grab_file/grab_file.h>
|
||||||
#include <common/decode_array.h>
|
#include <common/decode_array.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <devtools/gen_print_onion_wire.h>
|
|
||||||
#include <devtools/gen_print_wire.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <wire/onion_printgen.h>
|
||||||
|
#include <wire/peer_printgen.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -37,13 +37,13 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (onion)
|
if (onion)
|
||||||
if (tlv_name)
|
if (tlv_name)
|
||||||
printonion_type_tlv_message(tlv_name, m);
|
printonion_wire_tlv_message(tlv_name, m);
|
||||||
else
|
else
|
||||||
printonion_type_message(m);
|
printonion_wire_message(m);
|
||||||
else if (tlv_name)
|
else if (tlv_name)
|
||||||
printwire_type_tlv_message(tlv_name, m);
|
printpeer_wire_tlv_message(tlv_name, m);
|
||||||
else
|
else
|
||||||
printwire_type_message(m);
|
printpeer_wire_message(m);
|
||||||
} else {
|
} else {
|
||||||
u8 *f = grab_fd(NULL, STDIN_FILENO);
|
u8 *f = grab_fd(NULL, STDIN_FILENO);
|
||||||
size_t off = 0;
|
size_t off = 0;
|
||||||
@@ -64,13 +64,13 @@ int main(int argc, char *argv[])
|
|||||||
m = tal_dup_arr(f, u8, f + off, be16_to_cpu(len), 0);
|
m = tal_dup_arr(f, u8, f + off, be16_to_cpu(len), 0);
|
||||||
if (onion)
|
if (onion)
|
||||||
if (tlv_name)
|
if (tlv_name)
|
||||||
printonion_type_tlv_message(tlv_name, m);
|
printonion_wire_tlv_message(tlv_name, m);
|
||||||
else
|
else
|
||||||
printonion_type_message(m);
|
printonion_wire_message(m);
|
||||||
else if (tlv_name)
|
else if (tlv_name)
|
||||||
printwire_type_tlv_message(tlv_name, m);
|
printpeer_wire_tlv_message(tlv_name, m);
|
||||||
else
|
else
|
||||||
printwire_type_message(m);
|
printpeer_wire_message(m);
|
||||||
off += be16_to_cpu(len);
|
off += be16_to_cpu(len);
|
||||||
tal_free(m);
|
tal_free(m);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <common/type_to_string.h>
|
#include <common/type_to_string.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static bool verbose = false;
|
static bool verbose = false;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <common/gossip_constants.h>
|
#include <common/gossip_constants.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ static struct route_step *decode_with_privkey(const tal_t *ctx, const u8 *onion,
|
|||||||
struct privkey seckey;
|
struct privkey seckey;
|
||||||
struct route_step *step;
|
struct route_step *step;
|
||||||
struct onionpacket packet;
|
struct onionpacket packet;
|
||||||
enum onion_type why_bad;
|
enum onion_wire why_bad;
|
||||||
struct secret shared_secret;
|
struct secret shared_secret;
|
||||||
if (!hex_decode(hexprivkey, strlen(hexprivkey), &seckey, sizeof(seckey)))
|
if (!hex_decode(hexprivkey, strlen(hexprivkey), &seckey, sizeof(seckey)))
|
||||||
errx(1, "Invalid private key hex '%s'", hexprivkey);
|
errx(1, "Invalid private key hex '%s'", hexprivkey);
|
||||||
@@ -132,7 +132,7 @@ static struct route_step *decode_with_privkey(const tal_t *ctx, const u8 *onion,
|
|||||||
why_bad = parse_onionpacket(onion, TOTAL_PACKET_SIZE, &packet);
|
why_bad = parse_onionpacket(onion, TOTAL_PACKET_SIZE, &packet);
|
||||||
|
|
||||||
if (why_bad != 0)
|
if (why_bad != 0)
|
||||||
errx(1, "Error parsing message: %s", onion_type_name(why_bad));
|
errx(1, "Error parsing message: %s", onion_wire_name(why_bad));
|
||||||
|
|
||||||
if (!onion_shared_secret(&shared_secret, &packet, &seckey))
|
if (!onion_shared_secret(&shared_secret, &packet, &seckey))
|
||||||
errx(1, "Error creating shared secret.");
|
errx(1, "Error creating shared secret.");
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
#include <bitcoin/preimage.h>
|
#include <bitcoin/preimage.h>
|
||||||
#include <bitcoin/tx.h>
|
#include <bitcoin/tx.h>
|
||||||
#include <common/wireaddr.h>
|
#include <common/wireaddr.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct tlv_print_record_type {
|
struct tlv_print_record_type {
|
||||||
u64 type;
|
u64 type;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ GOSSIPD_COMMON_OBJS := \
|
|||||||
common/wire_error.o \
|
common/wire_error.o \
|
||||||
connectd/connectd_gossipd_wiregen.o \
|
connectd/connectd_gossipd_wiregen.o \
|
||||||
lightningd/gossip_msg.o \
|
lightningd/gossip_msg.o \
|
||||||
wire/gen_onion_wire.o
|
wire/onion_wiregen.o
|
||||||
|
|
||||||
$(LIGHTNINGD_GOSSIP_OBJS) $(LIGHTNINGD_GOSSIP_CLIENT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_GOSSIP_HEADERS)
|
$(LIGHTNINGD_GOSSIP_OBJS) $(LIGHTNINGD_GOSSIP_CLIENT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_GOSSIP_HEADERS)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <gossipd/gossipd.h>
|
#include <gossipd/gossipd.h>
|
||||||
#include <gossipd/gossipd_peerd_wiregen.h>
|
#include <gossipd/gossipd_peerd_wiregen.h>
|
||||||
#include <hsmd/hsmd_wiregen.h>
|
#include <hsmd/hsmd_wiregen.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
/* Create a node_announcement with the given signature. It may be NULL in the
|
/* Create a node_announcement with the given signature. It may be NULL in the
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
|
|
||||||
#define GOSSIP_STORE_FILENAME "gossip_store"
|
#define GOSSIP_STORE_FILENAME "gossip_store"
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire_io.h>
|
#include <wire/wire_io.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
@@ -439,7 +439,7 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
|
|||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
/* These are messages relayed from peer */
|
/* These are messages relayed from peer */
|
||||||
switch ((enum wire_type)fromwire_peektype(msg)) {
|
switch ((enum peer_wire)fromwire_peektype(msg)) {
|
||||||
case WIRE_CHANNEL_ANNOUNCEMENT:
|
case WIRE_CHANNEL_ANNOUNCEMENT:
|
||||||
err = handle_channel_announcement_msg(peer, msg);
|
err = handle_channel_announcement_msg(peer, msg);
|
||||||
goto handled_relay;
|
goto handled_relay;
|
||||||
@@ -493,7 +493,7 @@ static struct io_plan *peer_msg_in(struct io_conn *conn,
|
|||||||
#endif
|
#endif
|
||||||
status_broken("peer %s: relayed unexpected msg of type %s",
|
status_broken("peer %s: relayed unexpected msg of type %s",
|
||||||
type_to_string(tmpctx, struct node_id, &peer->id),
|
type_to_string(tmpctx, struct node_id, &peer->id),
|
||||||
wire_type_name(fromwire_peektype(msg)));
|
peer_wire_name(fromwire_peektype(msg)));
|
||||||
return io_close(conn);
|
return io_close(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <common/cryptomsg.h>
|
#include <common/cryptomsg.h>
|
||||||
#include <common/features.h>
|
#include <common/features.h>
|
||||||
#include <common/wireaddr.h>
|
#include <common/wireaddr.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
# Initialize the gossip daemon.
|
# Initialize the gossip daemon.
|
||||||
msgtype,gossipd_init,3000
|
msgtype,gossipd_init,3000
|
||||||
|
|||||||
|
Can't render this file because it has a wrong number of fields in line 7.
|
@@ -15,7 +15,7 @@
|
|||||||
#include <gossipd/queries.h>
|
#include <gossipd/queries.h>
|
||||||
#include <gossipd/routing.h>
|
#include <gossipd/routing.h>
|
||||||
#include <gossipd/seeker.h>
|
#include <gossipd/seeker.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <gossipd/gossipd_peerd_wiregen.h>
|
#include <gossipd/gossipd_peerd_wiregen.h>
|
||||||
#include <gossipd/gossipd_wiregen.h>
|
#include <gossipd/gossipd_wiregen.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
#ifndef SUPERVERBOSE
|
#ifndef SUPERVERBOSE
|
||||||
#define SUPERVERBOSE(...)
|
#define SUPERVERBOSE(...)
|
||||||
@@ -536,7 +536,7 @@ static void bad_gossip_order(const u8 *msg,
|
|||||||
{
|
{
|
||||||
status_peer_debug(peer ? &peer->id : NULL,
|
status_peer_debug(peer ? &peer->id : NULL,
|
||||||
"Bad gossip order: %s before announcement %s",
|
"Bad gossip order: %s before announcement %s",
|
||||||
wire_type_name(fromwire_peektype(msg)),
|
peer_wire_name(fromwire_peektype(msg)),
|
||||||
details);
|
details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <common/node_id.h>
|
#include <common/node_id.h>
|
||||||
#include <gossipd/broadcast.h>
|
#include <gossipd/broadcast.h>
|
||||||
#include <gossipd/gossip_store.h>
|
#include <gossipd/gossip_store.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
|
|
||||||
struct daemon;
|
struct daemon;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <gossipd/queries.h>
|
#include <gossipd/queries.h>
|
||||||
#include <gossipd/routing.h>
|
#include <gossipd/routing.h>
|
||||||
#include <gossipd/seeker.h>
|
#include <gossipd/seeker.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
#define GOSSIP_SEEKER_INTERVAL(seeker) \
|
#define GOSSIP_SEEKER_INTERVAL(seeker) \
|
||||||
DEV_FAST_GOSSIP((seeker)->daemon->rstate->dev_fast_gossip, 5, 60)
|
DEV_FAST_GOSSIP((seeker)->daemon->rstate->dev_fast_gossip, 5, 60)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ GOSSIPD_TEST_COMMON_OBJS := \
|
|||||||
common/pseudorand.o \
|
common/pseudorand.o \
|
||||||
common/type_to_string.o \
|
common/type_to_string.o \
|
||||||
common/utils.o \
|
common/utils.o \
|
||||||
wire/gen_peer_wire.o \
|
wire/peer_wiregen.o \
|
||||||
wire/fromwire.o \
|
wire/fromwire.o \
|
||||||
wire/towire.o
|
wire/towire.o
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,6 @@ check-whitespace: $(LIGHTNINGD_HSM_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNIN
|
|||||||
clean: lightningd/hsm-clean
|
clean: lightningd/hsm-clean
|
||||||
|
|
||||||
lightningd/hsm-clean:
|
lightningd/hsm-clean:
|
||||||
$(RM) $(LIGHTNINGD_HSM_OBJS) hsmd/gen_*
|
$(RM) $(LIGHTNINGD_HSM_OBJS)
|
||||||
|
|
||||||
-include hsmd/test/Makefile
|
-include hsmd/test/Makefile
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wally_bip32.h>
|
#include <wally_bip32.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire_io.h>
|
#include <wire/wire_io.h>
|
||||||
|
|
||||||
/*~ Each subdaemon is started with stdin connected to lightningd (for status
|
/*~ Each subdaemon is started with stdin connected to lightningd (for status
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <lightningd/onion_message.h>
|
#include <lightningd/onion_message.h>
|
||||||
#include <lightningd/peer_control.h>
|
#include <lightningd/peer_control.h>
|
||||||
#include <lightningd/subd.h>
|
#include <lightningd/subd.h>
|
||||||
#include <wire/gen_common_wire.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
static void update_feerates(struct lightningd *ld, struct channel *channel)
|
static void update_feerates(struct lightningd *ld, struct channel *channel)
|
||||||
@@ -406,7 +406,7 @@ static unsigned channel_msg(struct subd *sd, const u8 *msg, const int *fds)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((enum common_wire_type)t) {
|
switch ((enum common_wire)t) {
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
case WIRE_CUSTOMMSG_IN:
|
case WIRE_CUSTOMMSG_IN:
|
||||||
handle_custommsg_in(sd->ld, sd->node_id, msg);
|
handle_custommsg_in(sd->ld, sd->node_id, msg);
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <lightningd/opening_control.h>
|
#include <lightningd/opening_control.h>
|
||||||
#include <lightningd/peer_control.h>
|
#include <lightningd/peer_control.h>
|
||||||
#include <lightningd/subd.h>
|
#include <lightningd/subd.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
struct connect {
|
struct connect {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include <lightningd/ping.h>
|
#include <lightningd/ping.h>
|
||||||
#include <sodium/randombytes.h>
|
#include <sodium/randombytes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
static void got_txout(struct bitcoind *bitcoind,
|
static void got_txout(struct bitcoind *bitcoind,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <common/amount.h>
|
#include <common/amount.h>
|
||||||
#include <common/htlc_state.h>
|
#include <common/htlc_state.h>
|
||||||
#include <common/sphinx.h>
|
#include <common/sphinx.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
/* We look up HTLCs by channel & id */
|
/* We look up HTLCs by channel & id */
|
||||||
struct htlc_key {
|
struct htlc_key {
|
||||||
@@ -37,7 +37,7 @@ struct htlc_in {
|
|||||||
struct secret *shared_secret;
|
struct secret *shared_secret;
|
||||||
|
|
||||||
/* If we couldn't decode the onion, this contains the error code.. */
|
/* If we couldn't decode the onion, this contains the error code.. */
|
||||||
enum onion_type badonion;
|
enum onion_wire badonion;
|
||||||
|
|
||||||
/* Otherwise, this contains the failure message to send. */
|
/* Otherwise, this contains the failure message to send. */
|
||||||
const struct onionreply *failonion;
|
const struct onionreply *failonion;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <common/amount.h>
|
#include <common/amount.h>
|
||||||
#include <common/pseudorand.h>
|
#include <common/pseudorand.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct htlc_in;
|
struct htlc_in;
|
||||||
struct lightningd;
|
struct lightningd;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef LIGHTNING_LIGHTNINGD_INVOICE_H
|
#ifndef LIGHTNING_LIGHTNINGD_INVOICE_H
|
||||||
#define LIGHTNING_LIGHTNINGD_INVOICE_H
|
#define LIGHTNING_LIGHTNINGD_INVOICE_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct amount_msat;
|
struct amount_msat;
|
||||||
struct htlc_set;
|
struct htlc_set;
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ static void forward_event_notification_serialize(struct json_stream *stream,
|
|||||||
const struct short_channel_id *scid_out,
|
const struct short_channel_id *scid_out,
|
||||||
const struct amount_msat *amount_out,
|
const struct amount_msat *amount_out,
|
||||||
enum forward_status state,
|
enum forward_status state,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
struct timeabs *resolved_time)
|
struct timeabs *resolved_time)
|
||||||
{
|
{
|
||||||
/* Here is more neat to initial a forwarding structure than
|
/* Here is more neat to initial a forwarding structure than
|
||||||
@@ -256,7 +256,7 @@ void notify_forward_event(struct lightningd *ld,
|
|||||||
const struct short_channel_id *scid_out,
|
const struct short_channel_id *scid_out,
|
||||||
const struct amount_msat *amount_out,
|
const struct amount_msat *amount_out,
|
||||||
enum forward_status state,
|
enum forward_status state,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
struct timeabs *resolved_time)
|
struct timeabs *resolved_time)
|
||||||
{
|
{
|
||||||
void (*serialize)(struct json_stream *,
|
void (*serialize)(struct json_stream *,
|
||||||
@@ -264,7 +264,7 @@ void notify_forward_event(struct lightningd *ld,
|
|||||||
const struct short_channel_id *,
|
const struct short_channel_id *,
|
||||||
const struct amount_msat *,
|
const struct amount_msat *,
|
||||||
enum forward_status,
|
enum forward_status,
|
||||||
enum onion_type,
|
enum onion_wire,
|
||||||
struct timeabs *) = forward_event_notification_gen.serialize;
|
struct timeabs *) = forward_event_notification_gen.serialize;
|
||||||
|
|
||||||
struct jsonrpc_notification *n
|
struct jsonrpc_notification *n
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
#include <lightningd/pay.h>
|
#include <lightningd/pay.h>
|
||||||
#include <lightningd/plugin.h>
|
#include <lightningd/plugin.h>
|
||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct onionreply;
|
struct onionreply;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ void notify_forward_event(struct lightningd *ld,
|
|||||||
/* May be NULL. */
|
/* May be NULL. */
|
||||||
const struct amount_msat *amount_out,
|
const struct amount_msat *amount_out,
|
||||||
enum forward_status state,
|
enum forward_status state,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
struct timeabs *resolved_time);
|
struct timeabs *resolved_time);
|
||||||
|
|
||||||
void notify_sendpay_success(struct lightningd *ld,
|
void notify_sendpay_success(struct lightningd *ld,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <lightningd/subd.h>
|
#include <lightningd/subd.h>
|
||||||
#include <openingd/openingd_wiregen.h>
|
#include <openingd/openingd_wiregen.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wire/gen_common_wire.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
@@ -990,7 +990,7 @@ static unsigned int openingd_msg(struct subd *openingd,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((enum common_wire_type)t) {
|
switch ((enum common_wire)t) {
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
case WIRE_CUSTOMMSG_IN:
|
case WIRE_CUSTOMMSG_IN:
|
||||||
handle_custommsg_in(openingd->ld, openingd->node_id, msg);
|
handle_custommsg_in(openingd->ld, openingd->node_id, msg);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
/* Routing failure object */
|
/* Routing failure object */
|
||||||
struct routing_failure {
|
struct routing_failure {
|
||||||
unsigned int erring_index;
|
unsigned int erring_index;
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
const struct node_id *erring_node;
|
const struct node_id *erring_node;
|
||||||
const struct short_channel_id *erring_channel;
|
const struct short_channel_id *erring_channel;
|
||||||
int channel_dir;
|
int channel_dir;
|
||||||
@@ -144,13 +144,13 @@ static struct command_result *sendpay_success(struct command *cmd,
|
|||||||
static void
|
static void
|
||||||
json_add_routefail_info(struct json_stream *js,
|
json_add_routefail_info(struct json_stream *js,
|
||||||
unsigned int erring_index,
|
unsigned int erring_index,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
const struct node_id *erring_node,
|
const struct node_id *erring_node,
|
||||||
const struct short_channel_id *erring_channel,
|
const struct short_channel_id *erring_channel,
|
||||||
int channel_dir,
|
int channel_dir,
|
||||||
const u8 *msg)
|
const u8 *msg)
|
||||||
{
|
{
|
||||||
const char *failcodename = onion_type_name(failcode);
|
const char *failcodename = onion_wire_name(failcode);
|
||||||
|
|
||||||
json_add_num(js, "erring_index", erring_index);
|
json_add_num(js, "erring_index", erring_index);
|
||||||
json_add_num(js, "failcode", failcode);
|
json_add_num(js, "failcode", failcode);
|
||||||
@@ -201,7 +201,7 @@ static const char *sendpay_errmsg_fmt(const tal_t *ctx, errcode_t pay_errcode,
|
|||||||
else {
|
else {
|
||||||
assert(fail);
|
assert(fail);
|
||||||
errmsg = tal_fmt(ctx, "failed: %s (%s)",
|
errmsg = tal_fmt(ctx, "failed: %s (%s)",
|
||||||
onion_type_name(fail->failcode), details);
|
onion_wire_name(fail->failcode), details);
|
||||||
}
|
}
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
@@ -313,7 +313,7 @@ void payment_succeeded(struct lightningd *ld, struct htlc_out *hout,
|
|||||||
static struct routing_failure*
|
static struct routing_failure*
|
||||||
immediate_routing_failure(const tal_t *ctx,
|
immediate_routing_failure(const tal_t *ctx,
|
||||||
const struct lightningd *ld,
|
const struct lightningd *ld,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
const struct short_channel_id *channel0,
|
const struct short_channel_id *channel0,
|
||||||
const struct node_id *dstid)
|
const struct node_id *dstid)
|
||||||
{
|
{
|
||||||
@@ -340,7 +340,7 @@ static struct routing_failure*
|
|||||||
local_routing_failure(const tal_t *ctx,
|
local_routing_failure(const tal_t *ctx,
|
||||||
const struct lightningd *ld,
|
const struct lightningd *ld,
|
||||||
const struct htlc_out *hout,
|
const struct htlc_out *hout,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
const struct wallet_payment *payment)
|
const struct wallet_payment *payment)
|
||||||
{
|
{
|
||||||
struct routing_failure *routing_failure;
|
struct routing_failure *routing_failure;
|
||||||
@@ -366,7 +366,7 @@ local_routing_failure(const tal_t *ctx,
|
|||||||
|
|
||||||
log_debug(hout->key.channel->log, "local_routing_failure: %u (%s)",
|
log_debug(hout->key.channel->log, "local_routing_failure: %u (%s)",
|
||||||
routing_failure->failcode,
|
routing_failure->failcode,
|
||||||
onion_type_name(routing_failure->failcode));
|
onion_wire_name(routing_failure->failcode));
|
||||||
return routing_failure;
|
return routing_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ remote_routing_failure(const tal_t *ctx,
|
|||||||
struct log *log,
|
struct log *log,
|
||||||
errcode_t *pay_errcode)
|
errcode_t *pay_errcode)
|
||||||
{
|
{
|
||||||
enum onion_type failcode = fromwire_peektype(failuremsg);
|
enum onion_wire failcode = fromwire_peektype(failuremsg);
|
||||||
struct routing_failure *routing_failure;
|
struct routing_failure *routing_failure;
|
||||||
const struct node_id *route_nodes;
|
const struct node_id *route_nodes;
|
||||||
const struct node_id *erring_node;
|
const struct node_id *erring_node;
|
||||||
@@ -538,7 +538,7 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
|||||||
/* This gives more details than a generic failure message */
|
/* This gives more details than a generic failure message */
|
||||||
if (localfail) {
|
if (localfail) {
|
||||||
/* Use temporary_channel_failure if failmsg has it */
|
/* Use temporary_channel_failure if failmsg has it */
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
if (failmsg_needs_update)
|
if (failmsg_needs_update)
|
||||||
failcode = fromwire_peektype(failmsg_needs_update);
|
failcode = fromwire_peektype(failmsg_needs_update);
|
||||||
else
|
else
|
||||||
@@ -583,7 +583,7 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
|||||||
fail = NULL;
|
fail = NULL;
|
||||||
pay_errcode = PAY_UNPARSEABLE_ONION;
|
pay_errcode = PAY_UNPARSEABLE_ONION;
|
||||||
} else {
|
} else {
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
|
|
||||||
use_failmsg:
|
use_failmsg:
|
||||||
failcode = fromwire_peektype(failmsg);
|
failcode = fromwire_peektype(failmsg);
|
||||||
@@ -593,7 +593,7 @@ void payment_failed(struct lightningd *ld, const struct htlc_out *hout,
|
|||||||
"with code 0x%04x (%s)",
|
"with code 0x%04x (%s)",
|
||||||
hout->key.id,
|
hout->key.id,
|
||||||
origin_index,
|
origin_index,
|
||||||
failcode, onion_type_name(failcode));
|
failcode, onion_wire_name(failcode));
|
||||||
fail = remote_routing_failure(tmpctx, ld,
|
fail = remote_routing_failure(tmpctx, ld,
|
||||||
payment, failmsg,
|
payment, failmsg,
|
||||||
origin_index,
|
origin_index,
|
||||||
@@ -636,7 +636,7 @@ static struct command_result *wait_payment(struct lightningd *ld,
|
|||||||
struct onionreply *failonionreply;
|
struct onionreply *failonionreply;
|
||||||
bool faildestperm;
|
bool faildestperm;
|
||||||
int failindex;
|
int failindex;
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
struct node_id *failnode;
|
struct node_id *failnode;
|
||||||
struct short_channel_id *failchannel;
|
struct short_channel_id *failchannel;
|
||||||
u8 *failupdate;
|
u8 *failupdate;
|
||||||
@@ -1173,7 +1173,7 @@ static struct command_result *json_sendonion(struct command *cmd,
|
|||||||
{
|
{
|
||||||
u8 *onion;
|
u8 *onion;
|
||||||
struct onionpacket packet;
|
struct onionpacket packet;
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
struct route_hop *first_hop;
|
struct route_hop *first_hop;
|
||||||
struct sha256 *payment_hash;
|
struct sha256 *payment_hash;
|
||||||
struct lightningd *ld = cmd->ld;
|
struct lightningd *ld = cmd->ld;
|
||||||
|
|||||||
@@ -57,8 +57,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wally_bip32.h>
|
#include <wally_bip32.h>
|
||||||
#include <wire/gen_common_wire.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
struct close_command {
|
struct close_command {
|
||||||
@@ -2376,14 +2376,14 @@ static struct command_result *json_sendcustommsg(struct command *cmd,
|
|||||||
return command_param_failed();
|
return command_param_failed();
|
||||||
|
|
||||||
type = fromwire_peektype(msg);
|
type = fromwire_peektype(msg);
|
||||||
if (wire_type_is_defined(type)) {
|
if (peer_wire_is_defined(type)) {
|
||||||
return command_fail(
|
return command_fail(
|
||||||
cmd, JSONRPC2_INVALID_REQUEST,
|
cmd, JSONRPC2_INVALID_REQUEST,
|
||||||
"Cannot send messages of type %d (%s). It is not possible "
|
"Cannot send messages of type %d (%s). It is not possible "
|
||||||
"to send messages that have a type managed internally "
|
"to send messages that have a type managed internally "
|
||||||
"since that might cause issues with the internal state "
|
"since that might cause issues with the internal state "
|
||||||
"tracking.",
|
"tracking.",
|
||||||
type, wire_type_name(type));
|
type, peer_wire_name(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type % 2 == 0) {
|
if (type % 2 == 0) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include <lightningd/subd.h>
|
#include <lightningd/subd.h>
|
||||||
#include <onchaind/onchaind_wiregen.h>
|
#include <onchaind/onchaind_wiregen.h>
|
||||||
#include <wallet/wallet.h>
|
#include <wallet/wallet.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
#ifndef SUPERVERBOSE
|
#ifndef SUPERVERBOSE
|
||||||
@@ -105,7 +105,7 @@ static bool htlc_out_update_state(struct channel *channel,
|
|||||||
|
|
||||||
static struct failed_htlc *mk_failed_htlc_badonion(const tal_t *ctx,
|
static struct failed_htlc *mk_failed_htlc_badonion(const tal_t *ctx,
|
||||||
const struct htlc_in *hin,
|
const struct htlc_in *hin,
|
||||||
enum onion_type badonion)
|
enum onion_wire badonion)
|
||||||
{
|
{
|
||||||
struct failed_htlc *f = tal(ctx, struct failed_htlc);
|
struct failed_htlc *f = tal(ctx, struct failed_htlc);
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ static void fail_in_htlc(struct htlc_in *hin,
|
|||||||
|
|
||||||
/* Immediately fail HTLC with a BADONION code */
|
/* Immediately fail HTLC with a BADONION code */
|
||||||
static void local_fail_in_htlc_badonion(struct htlc_in *hin,
|
static void local_fail_in_htlc_badonion(struct htlc_in *hin,
|
||||||
enum onion_type badonion)
|
enum onion_wire badonion)
|
||||||
{
|
{
|
||||||
struct failed_htlc *failed_htlc;
|
struct failed_htlc *failed_htlc;
|
||||||
assert(!hin->preimage);
|
assert(!hin->preimage);
|
||||||
@@ -555,7 +555,7 @@ static void rcvd_htlc_reply(struct subd *subd, const u8 *msg, const int *fds UNU
|
|||||||
hout->failmsg = tal_steal(hout, failmsg);
|
hout->failmsg = tal_steal(hout, failmsg);
|
||||||
if (hout->am_origin) {
|
if (hout->am_origin) {
|
||||||
char *localfail = tal_fmt(msg, "%s: %s",
|
char *localfail = tal_fmt(msg, "%s: %s",
|
||||||
onion_type_name(fromwire_peektype(failmsg)),
|
onion_wire_name(fromwire_peektype(failmsg)),
|
||||||
failurestr);
|
failurestr);
|
||||||
payment_failed(ld, hout, localfail, NULL);
|
payment_failed(ld, hout, localfail, NULL);
|
||||||
|
|
||||||
@@ -1119,7 +1119,7 @@ static bool ecdh_maybe_blinding(const struct pubkey *ephemeral_key,
|
|||||||
static bool peer_accepted_htlc(const tal_t *ctx,
|
static bool peer_accepted_htlc(const tal_t *ctx,
|
||||||
struct channel *channel, u64 id,
|
struct channel *channel, u64 id,
|
||||||
bool replay,
|
bool replay,
|
||||||
enum onion_type *badonion,
|
enum onion_wire *badonion,
|
||||||
u8 **failmsg)
|
u8 **failmsg)
|
||||||
{
|
{
|
||||||
struct htlc_in *hin;
|
struct htlc_in *hin;
|
||||||
@@ -1185,7 +1185,7 @@ static bool peer_accepted_htlc(const tal_t *ctx,
|
|||||||
log_debug(channel->log,
|
log_debug(channel->log,
|
||||||
"Rejecting their htlc %"PRIu64
|
"Rejecting their htlc %"PRIu64
|
||||||
" since onion is unparsable %s",
|
" since onion is unparsable %s",
|
||||||
id, onion_type_name(*badonion));
|
id, onion_wire_name(*badonion));
|
||||||
/* Now we can fail it. */
|
/* Now we can fail it. */
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1198,7 +1198,7 @@ static bool peer_accepted_htlc(const tal_t *ctx,
|
|||||||
log_debug(channel->log,
|
log_debug(channel->log,
|
||||||
"Rejecting their htlc %"PRIu64
|
"Rejecting their htlc %"PRIu64
|
||||||
" since onion is unprocessable %s ss=%s",
|
" since onion is unprocessable %s ss=%s",
|
||||||
id, onion_type_name(*badonion),
|
id, onion_wire_name(*badonion),
|
||||||
type_to_string(tmpctx, struct secret, hin->shared_secret));
|
type_to_string(tmpctx, struct secret, hin->shared_secret));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@@ -1433,7 +1433,7 @@ void onchain_failed_our_htlc(const struct channel *channel,
|
|||||||
if (hout->am_origin) {
|
if (hout->am_origin) {
|
||||||
assert(why != NULL);
|
assert(why != NULL);
|
||||||
char *localfail = tal_fmt(channel, "%s: %s",
|
char *localfail = tal_fmt(channel, "%s: %s",
|
||||||
onion_type_name(WIRE_PERMANENT_CHANNEL_FAILURE),
|
onion_wire_name(WIRE_PERMANENT_CHANNEL_FAILURE),
|
||||||
why);
|
why);
|
||||||
payment_failed(ld, hout, localfail, NULL);
|
payment_failed(ld, hout, localfail, NULL);
|
||||||
tal_free(localfail);
|
tal_free(localfail);
|
||||||
@@ -1457,7 +1457,7 @@ static void remove_htlc_in(struct channel *channel, struct htlc_in *hin)
|
|||||||
log_debug(channel->log, "Removing in HTLC %"PRIu64" state %s %s",
|
log_debug(channel->log, "Removing in HTLC %"PRIu64" state %s %s",
|
||||||
hin->key.id, htlc_state_name(hin->hstate),
|
hin->key.id, htlc_state_name(hin->hstate),
|
||||||
hin->preimage ? "FULFILLED"
|
hin->preimage ? "FULFILLED"
|
||||||
: hin->badonion ? onion_type_name(hin->badonion)
|
: hin->badonion ? onion_wire_name(hin->badonion)
|
||||||
: "REMOTEFAIL");
|
: "REMOTEFAIL");
|
||||||
|
|
||||||
/* If we fulfilled their HTLC, credit us. */
|
/* If we fulfilled their HTLC, credit us. */
|
||||||
@@ -1503,7 +1503,7 @@ static void remove_htlc_out(struct channel *channel, struct htlc_out *hout)
|
|||||||
log_debug(channel->log, "Removing out HTLC %"PRIu64" state %s %s",
|
log_debug(channel->log, "Removing out HTLC %"PRIu64" state %s %s",
|
||||||
hout->key.id, htlc_state_name(hout->hstate),
|
hout->key.id, htlc_state_name(hout->hstate),
|
||||||
hout->preimage ? "FULFILLED"
|
hout->preimage ? "FULFILLED"
|
||||||
: hout->failmsg ? onion_type_name(fromwire_peektype(hout->failmsg))
|
: hout->failmsg ? onion_wire_name(fromwire_peektype(hout->failmsg))
|
||||||
: "REMOTEFAIL");
|
: "REMOTEFAIL");
|
||||||
|
|
||||||
/* If it's failed, now we can forward since it's completely locked-in */
|
/* If it's failed, now we can forward since it's completely locked-in */
|
||||||
@@ -1777,7 +1777,7 @@ static bool channel_added_their_htlc(struct channel *channel,
|
|||||||
struct htlc_in *hin;
|
struct htlc_in *hin;
|
||||||
struct secret shared_secret;
|
struct secret shared_secret;
|
||||||
struct onionpacket op;
|
struct onionpacket op;
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
|
|
||||||
/* BOLT #2:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
@@ -2042,7 +2042,7 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
|
|||||||
struct secret per_commitment_secret;
|
struct secret per_commitment_secret;
|
||||||
struct pubkey next_per_commitment_point;
|
struct pubkey next_per_commitment_point;
|
||||||
struct changed_htlc *changed;
|
struct changed_htlc *changed;
|
||||||
enum onion_type *badonions;
|
enum onion_wire *badonions;
|
||||||
u8 **failmsgs;
|
u8 **failmsgs;
|
||||||
size_t i;
|
size_t i;
|
||||||
struct lightningd *ld = channel->peer->ld;
|
struct lightningd *ld = channel->peer->ld;
|
||||||
@@ -2069,7 +2069,7 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
|
|||||||
revokenum, tal_count(changed));
|
revokenum, tal_count(changed));
|
||||||
|
|
||||||
/* Save any immediate failures for after we reply. */
|
/* Save any immediate failures for after we reply. */
|
||||||
badonions = tal_arrz(msg, enum onion_type, tal_count(changed));
|
badonions = tal_arrz(msg, enum onion_wire, tal_count(changed));
|
||||||
failmsgs = tal_arrz(msg, u8 *, tal_count(changed));
|
failmsgs = tal_arrz(msg, u8 *, tal_count(changed));
|
||||||
for (i = 0; i < tal_count(changed); i++) {
|
for (i = 0; i < tal_count(changed); i++) {
|
||||||
/* If we're doing final accept, we need to forward */
|
/* If we're doing final accept, we need to forward */
|
||||||
@@ -2456,7 +2456,7 @@ void htlcs_resubmit(struct lightningd *ld,
|
|||||||
{
|
{
|
||||||
struct htlc_in *hin;
|
struct htlc_in *hin;
|
||||||
struct htlc_in_map_iter ini;
|
struct htlc_in_map_iter ini;
|
||||||
enum onion_type badonion COMPILER_WANTS_INIT("gcc7.4.0 bad, 8.3 OK");
|
enum onion_wire badonion COMPILER_WANTS_INIT("gcc7.4.0 bad, 8.3 OK");
|
||||||
u8 *failmsg;
|
u8 *failmsg;
|
||||||
|
|
||||||
/* Now retry any which were stuck. */
|
/* Now retry any which were stuck. */
|
||||||
@@ -2555,7 +2555,7 @@ void json_format_forwarding_object(struct json_stream *response,
|
|||||||
if (cur->failcode != 0) {
|
if (cur->failcode != 0) {
|
||||||
json_add_num(response, "failcode", cur->failcode);
|
json_add_num(response, "failcode", cur->failcode);
|
||||||
json_add_string(response, "failreason",
|
json_add_string(response, "failreason",
|
||||||
onion_type_name(cur->failcode));
|
onion_wire_name(cur->failcode));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef COMPAT_V070
|
#ifdef COMPAT_V070
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wallet/db.h>
|
#include <wallet/db.h>
|
||||||
#include <wire/gen_common_wire.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/wire_io.h>
|
#include <wire/wire_io.h>
|
||||||
|
|
||||||
static bool move_fd(int from, int to)
|
static bool move_fd(int from, int to)
|
||||||
@@ -747,7 +747,7 @@ void subd_send_msg(struct subd *sd, const u8 *msg_out)
|
|||||||
u16 type = fromwire_peektype(msg_out);
|
u16 type = fromwire_peektype(msg_out);
|
||||||
/* FIXME: We should use unique upper bits for each daemon, then
|
/* FIXME: We should use unique upper bits for each daemon, then
|
||||||
* have generate-wire.py add them, just assert here. */
|
* have generate-wire.py add them, just assert here. */
|
||||||
assert(!strstarts(common_wire_type_name(type), "INVALID") ||
|
assert(!strstarts(common_wire_name(type), "INVALID") ||
|
||||||
!strstarts(sd->msgname(type), "INVALID"));
|
!strstarts(sd->msgname(type), "INVALID"));
|
||||||
msg_enqueue(sd->outq, msg_out);
|
msg_enqueue(sd->outq, msg_out);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,6 +95,6 @@ check-whitespace: $(LIGHTNINGD_ONCHAIN_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNI
|
|||||||
clean: onchaind-clean
|
clean: onchaind-clean
|
||||||
|
|
||||||
onchaind-clean:
|
onchaind-clean:
|
||||||
$(RM) $(LIGHTNINGD_ONCHAIN_OBJS) onchaind/gen_*
|
$(RM) $(LIGHTNINGD_ONCHAIN_OBJS)
|
||||||
|
|
||||||
-include onchaind/test/Makefile
|
-include onchaind/test/Makefile
|
||||||
|
|||||||
@@ -104,6 +104,6 @@ check-whitespace: $(LIGHTNINGD_OPENING_SRC_NOGEN:%=check-whitespace/%) $(LIGHTNI
|
|||||||
clean: opening-clean
|
clean: opening-clean
|
||||||
|
|
||||||
opening-clean:
|
opening-clean:
|
||||||
$(RM) $(LIGHTNINGD_OPENING_OBJS) openingd/gen_*
|
$(RM) $(LIGHTNINGD_OPENING_OBJS)
|
||||||
|
|
||||||
-include openingd/test/Makefile
|
-include openingd/test/Makefile
|
||||||
|
|||||||
@@ -49,9 +49,9 @@
|
|||||||
#include <secp256k1.h>
|
#include <secp256k1.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <wally_bip32.h>
|
#include <wally_bip32.h>
|
||||||
#include <wire/gen_common_wire.h>
|
#include <wire/common_wiregen.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
|
||||||
#include <wire/peer_wire.h>
|
#include <wire/peer_wire.h>
|
||||||
|
#include <wire/peer_wiregen.h>
|
||||||
#include <wire/wire.h>
|
#include <wire/wire.h>
|
||||||
#include <wire/wire_sync.h>
|
#include <wire/wire_sync.h>
|
||||||
|
|
||||||
@@ -485,7 +485,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state,
|
|||||||
* this could be connectd itself, in fact. */
|
* this could be connectd itself, in fact. */
|
||||||
if (is_wrong_channel(msg, &state->channel_id, &actual)) {
|
if (is_wrong_channel(msg, &state->channel_id, &actual)) {
|
||||||
status_debug("Rejecting %s for unknown channel_id %s",
|
status_debug("Rejecting %s for unknown channel_id %s",
|
||||||
wire_type_name(fromwire_peektype(msg)),
|
peer_wire_name(fromwire_peektype(msg)),
|
||||||
type_to_string(tmpctx, struct channel_id,
|
type_to_string(tmpctx, struct channel_id,
|
||||||
&actual));
|
&actual));
|
||||||
sync_crypto_write(state->pps,
|
sync_crypto_write(state->pps,
|
||||||
@@ -1324,7 +1324,7 @@ static u8 *fundee_channel(struct state *state, const u8 *open_channel_msg)
|
|||||||
static u8 *handle_peer_in(struct state *state)
|
static u8 *handle_peer_in(struct state *state)
|
||||||
{
|
{
|
||||||
u8 *msg = sync_crypto_read(tmpctx, state->pps);
|
u8 *msg = sync_crypto_read(tmpctx, state->pps);
|
||||||
enum wire_type t = fromwire_peektype(msg);
|
enum peer_wire t = fromwire_peektype(msg);
|
||||||
struct channel_id channel_id;
|
struct channel_id channel_id;
|
||||||
|
|
||||||
if (t == WIRE_OPEN_CHANNEL)
|
if (t == WIRE_OPEN_CHANNEL)
|
||||||
@@ -1332,8 +1332,8 @@ static u8 *handle_peer_in(struct state *state)
|
|||||||
|
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
/* Handle custommsgs */
|
/* Handle custommsgs */
|
||||||
enum wire_type type = fromwire_peektype(msg);
|
enum peer_wire type = fromwire_peektype(msg);
|
||||||
if (type % 2 == 1 && !wire_type_is_defined(type)) {
|
if (type % 2 == 1 && !peer_wire_is_defined(type)) {
|
||||||
/* The message is not part of the messages we know how to
|
/* The message is not part of the messages we know how to
|
||||||
* handle. Assuming this is a custommsg, we just forward it to the
|
* handle. Assuming this is a custommsg, we just forward it to the
|
||||||
* master. */
|
* master. */
|
||||||
@@ -1351,13 +1351,13 @@ static u8 *handle_peer_in(struct state *state)
|
|||||||
take(towire_errorfmt(NULL,
|
take(towire_errorfmt(NULL,
|
||||||
extract_channel_id(msg, &channel_id) ? &channel_id : NULL,
|
extract_channel_id(msg, &channel_id) ? &channel_id : NULL,
|
||||||
"Unexpected message %s: %s",
|
"Unexpected message %s: %s",
|
||||||
wire_type_name(t),
|
peer_wire_name(t),
|
||||||
tal_hex(tmpctx, msg))));
|
tal_hex(tmpctx, msg))));
|
||||||
|
|
||||||
/* FIXME: We don't actually want master to try to send an
|
/* FIXME: We don't actually want master to try to send an
|
||||||
* error, since peer is transient. This is a hack.
|
* error, since peer is transient. This is a hack.
|
||||||
*/
|
*/
|
||||||
status_broken("Unexpected message %s", wire_type_name(t));
|
status_broken("Unexpected message %s", peer_wire_name(t));
|
||||||
peer_failed_connection_lost();
|
peer_failed_connection_lost();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1483,7 +1483,7 @@ static u8 *handle_master_in(struct state *state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Now handle common messages. */
|
/* Now handle common messages. */
|
||||||
switch ((enum common_wire_type)t) {
|
switch ((enum common_wire)t) {
|
||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
case WIRE_CUSTOMMSG_OUT:
|
case WIRE_CUSTOMMSG_OUT:
|
||||||
openingd_send_custommsg(state, msg);
|
openingd_send_custommsg(state, msg);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ PLUGIN_COMMON_OBJS := \
|
|||||||
common/version.o \
|
common/version.o \
|
||||||
common/wireaddr.o \
|
common/wireaddr.o \
|
||||||
wire/fromwire.o \
|
wire/fromwire.o \
|
||||||
wire/gen_onion_wire.o \
|
wire/onion_wiregen.o \
|
||||||
wire/tlvstream.o \
|
wire/tlvstream.o \
|
||||||
wire/towire.o
|
wire/towire.o
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ plugins/fundchannel: common/addr.o $(PLUGIN_FUNDCHANNEL_OBJS) $(PLUGIN_LIB_OBJS)
|
|||||||
|
|
||||||
plugins/bcli: bitcoin/chainparams.o $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
|
plugins/bcli: bitcoin/chainparams.o $(PLUGIN_BCLI_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
|
||||||
|
|
||||||
plugins/keysend: bitcoin/chainparams.o wire/tlvstream.o wire/gen_onion_wire.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
|
plugins/keysend: bitcoin/chainparams.o wire/tlvstream.o wire/onion_wiregen.o $(PLUGIN_KEYSEND_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_PAY_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS) $(CCAN_OBJS)
|
||||||
$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
|
$(PLUGIN_KEYSEND_OBJS): $(PLUGIN_PAY_LIB_HEADER)
|
||||||
|
|
||||||
$(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER)
|
$(PLUGIN_ALL_OBJS): $(PLUGIN_LIB_HEADER)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <ccan/tal/str/str.h>
|
#include <ccan/tal/str/str.h>
|
||||||
#include <plugins/libplugin-pay.h>
|
#include <plugins/libplugin-pay.h>
|
||||||
#include <plugins/libplugin.h>
|
#include <plugins/libplugin.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
#define PREIMAGE_TLV_TYPE 5482373484
|
#define PREIMAGE_TLV_TYPE 5482373484
|
||||||
#define KEYSEND_FEATUREBIT 55
|
#define KEYSEND_FEATUREBIT 55
|
||||||
|
|||||||
@@ -862,7 +862,7 @@ failure_is_blockheight_disagreement(const struct payment *p,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *describe_failcode(const tal_t *ctx, enum onion_type failcode)
|
static char *describe_failcode(const tal_t *ctx, enum onion_wire failcode)
|
||||||
{
|
{
|
||||||
char *rv = tal_strdup(ctx, "");
|
char *rv = tal_strdup(ctx, "");
|
||||||
if (failcode & BADONION) {
|
if (failcode & BADONION) {
|
||||||
@@ -889,7 +889,7 @@ static struct command_result *
|
|||||||
handle_final_failure(struct command *cmd,
|
handle_final_failure(struct command *cmd,
|
||||||
struct payment *p,
|
struct payment *p,
|
||||||
const struct node_id *final_id,
|
const struct node_id *final_id,
|
||||||
enum onion_type failcode)
|
enum onion_wire failcode)
|
||||||
{
|
{
|
||||||
u32 unused;
|
u32 unused;
|
||||||
|
|
||||||
@@ -905,7 +905,7 @@ handle_final_failure(struct command *cmd,
|
|||||||
paymod_log(p, LOG_DBG,
|
paymod_log(p, LOG_DBG,
|
||||||
"Final node %s reported %04x (%s) on route %s",
|
"Final node %s reported %04x (%s) on route %s",
|
||||||
type_to_string(tmpctx, struct node_id, final_id),
|
type_to_string(tmpctx, struct node_id, final_id),
|
||||||
failcode, onion_type_name(failcode),
|
failcode, onion_wire_name(failcode),
|
||||||
p->routetxt);
|
p->routetxt);
|
||||||
|
|
||||||
/* We use an exhaustive switch statement here so you get a compile
|
/* We use an exhaustive switch statement here so you get a compile
|
||||||
@@ -998,14 +998,14 @@ handle_intermediate_failure(struct command *cmd,
|
|||||||
struct payment *p,
|
struct payment *p,
|
||||||
const struct node_id *errnode,
|
const struct node_id *errnode,
|
||||||
const struct route_hop *errchan,
|
const struct route_hop *errchan,
|
||||||
enum onion_type failcode)
|
enum onion_wire failcode)
|
||||||
{
|
{
|
||||||
struct payment *root = payment_root(p);
|
struct payment *root = payment_root(p);
|
||||||
|
|
||||||
paymod_log(p, LOG_DBG,
|
paymod_log(p, LOG_DBG,
|
||||||
"Intermediate node %s reported %04x (%s) at %s on route %s",
|
"Intermediate node %s reported %04x (%s) at %s on route %s",
|
||||||
type_to_string(tmpctx, struct node_id, errnode),
|
type_to_string(tmpctx, struct node_id, errnode),
|
||||||
failcode, onion_type_name(failcode),
|
failcode, onion_wire_name(failcode),
|
||||||
type_to_string(tmpctx, struct short_channel_id,
|
type_to_string(tmpctx, struct short_channel_id,
|
||||||
&errchan->channel_id),
|
&errchan->channel_id),
|
||||||
p->routetxt);
|
p->routetxt);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <common/bolt11.h>
|
#include <common/bolt11.h>
|
||||||
#include <plugins/libplugin.h>
|
#include <plugins/libplugin.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
struct legacy_payload {
|
struct legacy_payload {
|
||||||
struct short_channel_id scid;
|
struct short_channel_id scid;
|
||||||
@@ -46,7 +46,7 @@ struct payment_result {
|
|||||||
struct preimage *payment_preimage;
|
struct preimage *payment_preimage;
|
||||||
u32 code;
|
u32 code;
|
||||||
const char* failcodename;
|
const char* failcodename;
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
const u8 *raw_message;
|
const u8 *raw_message;
|
||||||
const char *message;
|
const char *message;
|
||||||
u32 *erring_index;
|
u32 *erring_index;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ tools/test/gen_test.c.tmp.c: $(TOOLS_WIRE_DEPS)
|
|||||||
tools/test/gen_test.c: tools/test/gen_test.c.tmp.c $(EXTERNAL_HEADERS) tools/test/gen_test.h
|
tools/test/gen_test.c: tools/test/gen_test.c.tmp.c $(EXTERNAL_HEADERS) tools/test/gen_test.h
|
||||||
@MAKE=$(MAKE) tools/update-mocks.sh "$<" $(SUPPRESS_OUTPUT) && mv "$<" "$@"
|
@MAKE=$(MAKE) tools/update-mocks.sh "$<" $(SUPPRESS_OUTPUT) && mv "$<" "$@"
|
||||||
|
|
||||||
tools/test/gen_print.h: wire/gen_onion_wire.h $(TOOLS_WIRE_DEPS)
|
tools/test/gen_print.h: wire/onion_wiregen.h $(TOOLS_WIRE_DEPS)
|
||||||
$(BOLT_GEN) -P --page header $@ test_type < tools/test/test_cases > $@
|
$(BOLT_GEN) -P --page header $@ test_type < tools/test/test_cases > $@
|
||||||
|
|
||||||
tools/test/gen_print.c: $(TOOLS_WIRE_DEPS)
|
tools/test/gen_print.c: $(TOOLS_WIRE_DEPS)
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ void notify_forward_event(struct lightningd *ld UNNEEDED,
|
|||||||
/* May be NULL. */
|
/* May be NULL. */
|
||||||
const struct amount_msat *amount_out UNNEEDED,
|
const struct amount_msat *amount_out UNNEEDED,
|
||||||
enum forward_status state UNNEEDED,
|
enum forward_status state UNNEEDED,
|
||||||
enum onion_type failcode UNNEEDED,
|
enum onion_wire failcode UNNEEDED,
|
||||||
struct timeabs *resolved_time UNNEEDED)
|
struct timeabs *resolved_time UNNEEDED)
|
||||||
{ fprintf(stderr, "notify_forward_event called!\n"); abort(); }
|
{ fprintf(stderr, "notify_forward_event called!\n"); abort(); }
|
||||||
/* Generated stub for onchaind_funding_spent */
|
/* Generated stub for onchaind_funding_spent */
|
||||||
@@ -456,9 +456,9 @@ struct onion_payload *onion_decode(const tal_t *ctx UNNEEDED,
|
|||||||
u64 *failtlvtype UNNEEDED,
|
u64 *failtlvtype UNNEEDED,
|
||||||
size_t *failtlvpos UNNEEDED)
|
size_t *failtlvpos UNNEEDED)
|
||||||
{ fprintf(stderr, "onion_decode called!\n"); abort(); }
|
{ fprintf(stderr, "onion_decode called!\n"); abort(); }
|
||||||
/* Generated stub for onion_type_name */
|
/* Generated stub for onion_wire_name */
|
||||||
const char *onion_type_name(int e UNNEEDED)
|
const char *onion_wire_name(int e UNNEEDED)
|
||||||
{ fprintf(stderr, "onion_type_name called!\n"); abort(); }
|
{ fprintf(stderr, "onion_wire_name called!\n"); abort(); }
|
||||||
/* Generated stub for outpointfilter_add */
|
/* Generated stub for outpointfilter_add */
|
||||||
void outpointfilter_add(struct outpointfilter *of UNNEEDED,
|
void outpointfilter_add(struct outpointfilter *of UNNEEDED,
|
||||||
const struct bitcoin_txid *txid UNNEEDED, const u32 outnum UNNEEDED)
|
const struct bitcoin_txid *txid UNNEEDED, const u32 outnum UNNEEDED)
|
||||||
@@ -544,7 +544,7 @@ struct command_result *param_tok(struct command *cmd UNNEEDED, const char *name
|
|||||||
const jsmntok_t **out UNNEEDED)
|
const jsmntok_t **out UNNEEDED)
|
||||||
{ fprintf(stderr, "param_tok called!\n"); abort(); }
|
{ fprintf(stderr, "param_tok called!\n"); abort(); }
|
||||||
/* Generated stub for parse_onionpacket */
|
/* Generated stub for parse_onionpacket */
|
||||||
enum onion_type parse_onionpacket(const u8 *src UNNEEDED,
|
enum onion_wire parse_onionpacket(const u8 *src UNNEEDED,
|
||||||
const size_t srclen UNNEEDED,
|
const size_t srclen UNNEEDED,
|
||||||
struct onionpacket *dest UNNEEDED)
|
struct onionpacket *dest UNNEEDED)
|
||||||
{ fprintf(stderr, "parse_onionpacket called!\n"); abort(); }
|
{ fprintf(stderr, "parse_onionpacket called!\n"); abort(); }
|
||||||
@@ -582,6 +582,12 @@ void peer_start_openingd(struct peer *peer UNNEEDED,
|
|||||||
struct per_peer_state *pps UNNEEDED,
|
struct per_peer_state *pps UNNEEDED,
|
||||||
const u8 *msg UNNEEDED)
|
const u8 *msg UNNEEDED)
|
||||||
{ fprintf(stderr, "peer_start_openingd called!\n"); abort(); }
|
{ fprintf(stderr, "peer_start_openingd called!\n"); abort(); }
|
||||||
|
/* Generated stub for peer_wire_is_defined */
|
||||||
|
bool peer_wire_is_defined(u16 type UNNEEDED)
|
||||||
|
{ fprintf(stderr, "peer_wire_is_defined called!\n"); abort(); }
|
||||||
|
/* Generated stub for peer_wire_name */
|
||||||
|
const char *peer_wire_name(int e UNNEEDED)
|
||||||
|
{ fprintf(stderr, "peer_wire_name called!\n"); abort(); }
|
||||||
/* Generated stub for per_peer_state_set_fds */
|
/* Generated stub for per_peer_state_set_fds */
|
||||||
void per_peer_state_set_fds(struct per_peer_state *pps UNNEEDED,
|
void per_peer_state_set_fds(struct per_peer_state *pps UNNEEDED,
|
||||||
int peer_fd UNNEEDED, int gossip_fd UNNEEDED, int gossip_store_fd UNNEEDED)
|
int peer_fd UNNEEDED, int gossip_fd UNNEEDED, int gossip_store_fd UNNEEDED)
|
||||||
@@ -763,12 +769,6 @@ struct txowatch *watch_txo(const tal_t *ctx UNNEEDED,
|
|||||||
size_t input_num UNNEEDED,
|
size_t input_num UNNEEDED,
|
||||||
const struct block *block))
|
const struct block *block))
|
||||||
{ fprintf(stderr, "watch_txo called!\n"); abort(); }
|
{ fprintf(stderr, "watch_txo called!\n"); abort(); }
|
||||||
/* Generated stub for wire_type_is_defined */
|
|
||||||
bool wire_type_is_defined(u16 type UNNEEDED)
|
|
||||||
{ fprintf(stderr, "wire_type_is_defined called!\n"); abort(); }
|
|
||||||
/* Generated stub for wire_type_name */
|
|
||||||
const char *wire_type_name(int e UNNEEDED)
|
|
||||||
{ fprintf(stderr, "wire_type_name called!\n"); abort(); }
|
|
||||||
/* Generated stub for wrap_onionreply */
|
/* Generated stub for wrap_onionreply */
|
||||||
struct onionreply *wrap_onionreply(const tal_t *ctx UNNEEDED,
|
struct onionreply *wrap_onionreply(const tal_t *ctx UNNEEDED,
|
||||||
const struct secret *shared_secret UNNEEDED,
|
const struct secret *shared_secret UNNEEDED,
|
||||||
|
|||||||
@@ -2103,7 +2103,7 @@ void wallet_htlc_save_out(struct wallet *wallet,
|
|||||||
void wallet_htlc_update(struct wallet *wallet, const u64 htlc_dbid,
|
void wallet_htlc_update(struct wallet *wallet, const u64 htlc_dbid,
|
||||||
const enum htlc_state new_state,
|
const enum htlc_state new_state,
|
||||||
const struct preimage *payment_key,
|
const struct preimage *payment_key,
|
||||||
enum onion_type badonion,
|
enum onion_wire badonion,
|
||||||
const struct onionreply *failonion,
|
const struct onionreply *failonion,
|
||||||
const u8 *failmsg,
|
const u8 *failmsg,
|
||||||
bool *we_filled)
|
bool *we_filled)
|
||||||
@@ -2210,7 +2210,7 @@ static bool wallet_stmt2htlc_in(struct channel *channel,
|
|||||||
log_broken(channel->log,
|
log_broken(channel->log,
|
||||||
"Replacing incoming HTLC %"PRIu64" error "
|
"Replacing incoming HTLC %"PRIu64" error "
|
||||||
"%s with WIRE_TEMPORARY_NODE_FAILURE",
|
"%s with WIRE_TEMPORARY_NODE_FAILURE",
|
||||||
in->key.id, onion_type_name(in->badonion));
|
in->key.id, onion_wire_name(in->badonion));
|
||||||
in->badonion = 0;
|
in->badonion = 0;
|
||||||
in->failonion = create_onionreply(in,
|
in->failonion = create_onionreply(in,
|
||||||
in->shared_secret,
|
in->shared_secret,
|
||||||
@@ -2888,7 +2888,7 @@ void wallet_payment_get_failinfo(const tal_t *ctx,
|
|||||||
struct onionreply **failonionreply,
|
struct onionreply **failonionreply,
|
||||||
bool *faildestperm,
|
bool *faildestperm,
|
||||||
int *failindex,
|
int *failindex,
|
||||||
enum onion_type *failcode,
|
enum onion_wire *failcode,
|
||||||
struct node_id **failnode,
|
struct node_id **failnode,
|
||||||
struct short_channel_id **failchannel,
|
struct short_channel_id **failchannel,
|
||||||
u8 **failupdate,
|
u8 **failupdate,
|
||||||
@@ -2919,7 +2919,7 @@ void wallet_payment_get_failinfo(const tal_t *ctx,
|
|||||||
}
|
}
|
||||||
*faildestperm = db_column_int(stmt, 1) != 0;
|
*faildestperm = db_column_int(stmt, 1) != 0;
|
||||||
*failindex = db_column_int(stmt, 2);
|
*failindex = db_column_int(stmt, 2);
|
||||||
*failcode = (enum onion_type) db_column_int(stmt, 3);
|
*failcode = (enum onion_wire) db_column_int(stmt, 3);
|
||||||
if (db_column_is_null(stmt, 4))
|
if (db_column_is_null(stmt, 4))
|
||||||
*failnode = NULL;
|
*failnode = NULL;
|
||||||
else {
|
else {
|
||||||
@@ -2958,7 +2958,7 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
|
|||||||
const struct onionreply *failonionreply,
|
const struct onionreply *failonionreply,
|
||||||
bool faildestperm,
|
bool faildestperm,
|
||||||
int failindex,
|
int failindex,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
const struct node_id *failnode,
|
const struct node_id *failnode,
|
||||||
const struct short_channel_id *failchannel,
|
const struct short_channel_id *failchannel,
|
||||||
const u8 *failupdate /*tal_arr*/,
|
const u8 *failupdate /*tal_arr*/,
|
||||||
@@ -3724,7 +3724,7 @@ static bool wallet_forwarded_payment_update(struct wallet *w,
|
|||||||
const struct htlc_in *in,
|
const struct htlc_in *in,
|
||||||
const struct htlc_out *out,
|
const struct htlc_out *out,
|
||||||
enum forward_status state,
|
enum forward_status state,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
struct timeabs *resolved_time)
|
struct timeabs *resolved_time)
|
||||||
{
|
{
|
||||||
struct db_stmt *stmt;
|
struct db_stmt *stmt;
|
||||||
@@ -3777,7 +3777,7 @@ void wallet_forwarded_payment_add(struct wallet *w, const struct htlc_in *in,
|
|||||||
const struct short_channel_id *scid_out,
|
const struct short_channel_id *scid_out,
|
||||||
const struct htlc_out *out,
|
const struct htlc_out *out,
|
||||||
enum forward_status state,
|
enum forward_status state,
|
||||||
enum onion_type failcode)
|
enum onion_wire failcode)
|
||||||
{
|
{
|
||||||
struct db_stmt *stmt;
|
struct db_stmt *stmt;
|
||||||
struct timeabs *resolved_time;
|
struct timeabs *resolved_time;
|
||||||
|
|||||||
@@ -20,9 +20,8 @@
|
|||||||
#include <lightningd/log.h>
|
#include <lightningd/log.h>
|
||||||
#include <onchaind/onchaind_wire.h>
|
#include <onchaind/onchaind_wire.h>
|
||||||
#include <wally_bip32.h>
|
#include <wally_bip32.h>
|
||||||
#include <wire/gen_onion_wire.h>
|
#include <wire/onion_wiregen.h>
|
||||||
|
|
||||||
enum onion_type;
|
|
||||||
struct amount_msat;
|
struct amount_msat;
|
||||||
struct invoices;
|
struct invoices;
|
||||||
struct channel;
|
struct channel;
|
||||||
@@ -194,7 +193,7 @@ struct forwarding {
|
|||||||
struct amount_msat msat_in, msat_out, fee;
|
struct amount_msat msat_in, msat_out, fee;
|
||||||
struct sha256 *payment_hash;
|
struct sha256 *payment_hash;
|
||||||
enum forward_status status;
|
enum forward_status status;
|
||||||
enum onion_type failcode;
|
enum onion_wire failcode;
|
||||||
struct timeabs received_time;
|
struct timeabs received_time;
|
||||||
/* May not be present if the HTLC was not resolved yet. */
|
/* May not be present if the HTLC was not resolved yet. */
|
||||||
struct timeabs *resolved_time;
|
struct timeabs *resolved_time;
|
||||||
@@ -662,7 +661,7 @@ void wallet_htlc_save_out(struct wallet *wallet,
|
|||||||
void wallet_htlc_update(struct wallet *wallet, const u64 htlc_dbid,
|
void wallet_htlc_update(struct wallet *wallet, const u64 htlc_dbid,
|
||||||
const enum htlc_state new_state,
|
const enum htlc_state new_state,
|
||||||
const struct preimage *payment_key,
|
const struct preimage *payment_key,
|
||||||
enum onion_type badonion,
|
enum onion_wire badonion,
|
||||||
const struct onionreply *failonion,
|
const struct onionreply *failonion,
|
||||||
const u8 *failmsg,
|
const u8 *failmsg,
|
||||||
bool *we_filled);
|
bool *we_filled);
|
||||||
@@ -1075,7 +1074,7 @@ void wallet_payment_get_failinfo(const tal_t *ctx,
|
|||||||
struct onionreply **failonionreply,
|
struct onionreply **failonionreply,
|
||||||
bool *faildestperm,
|
bool *faildestperm,
|
||||||
int *failindex,
|
int *failindex,
|
||||||
enum onion_type *failcode,
|
enum onion_wire *failcode,
|
||||||
struct node_id **failnode,
|
struct node_id **failnode,
|
||||||
struct short_channel_id **failchannel,
|
struct short_channel_id **failchannel,
|
||||||
u8 **failupdate,
|
u8 **failupdate,
|
||||||
@@ -1091,7 +1090,7 @@ void wallet_payment_set_failinfo(struct wallet *wallet,
|
|||||||
const struct onionreply *failonionreply,
|
const struct onionreply *failonionreply,
|
||||||
bool faildestperm,
|
bool faildestperm,
|
||||||
int failindex,
|
int failindex,
|
||||||
enum onion_type failcode,
|
enum onion_wire failcode,
|
||||||
const struct node_id *failnode,
|
const struct node_id *failnode,
|
||||||
const struct short_channel_id *failchannel,
|
const struct short_channel_id *failchannel,
|
||||||
const u8 *failupdate,
|
const u8 *failupdate,
|
||||||
@@ -1251,7 +1250,7 @@ void wallet_forwarded_payment_add(struct wallet *w, const struct htlc_in *in,
|
|||||||
const struct short_channel_id *scid_out,
|
const struct short_channel_id *scid_out,
|
||||||
const struct htlc_out *out,
|
const struct htlc_out *out,
|
||||||
enum forward_status state,
|
enum forward_status state,
|
||||||
enum onion_type failcode);
|
enum onion_wire failcode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve summary of successful forwarded payments' fees
|
* Retrieve summary of successful forwarded payments' fees
|
||||||
|
|||||||
@@ -10,9 +10,16 @@ WIRE_HEADERS_NOGEN := wire/onion_defs.h \
|
|||||||
wire/wire.h \
|
wire/wire.h \
|
||||||
wire/wire_sync.h \
|
wire/wire_sync.h \
|
||||||
wire/wire_io.h
|
wire/wire_io.h
|
||||||
WIRE_GEN_HEADERS := wire/gen_peer_wire.h wire/gen_onion_wire.h wire/gen_common_wire.h
|
WIRE_GEN_HEADERS := wire/peer_wiregen.h \
|
||||||
WIRE_GEN_SRC := wire/gen_peer_wire.c wire/gen_common_wire.c
|
wire/onion_wiregen.h \
|
||||||
WIRE_GEN_ONION_SRC := wire/gen_onion_wire.c
|
wire/common_wiregen.h \
|
||||||
|
wire/peer_printgen.h \
|
||||||
|
wire/onion_printgen.h
|
||||||
|
|
||||||
|
WIRE_GEN_SRC := wire/peer_wiregen.c wire/common_wiregen.c
|
||||||
|
WIRE_GEN_ONION_SRC := wire/onion_wiregen.c
|
||||||
|
WIRE_GEN_PRINT_SRC := wire/peer_printgen.c wire/onion_printgen.c
|
||||||
|
|
||||||
WIRE_SRC := wire/wire_sync.c \
|
WIRE_SRC := wire/wire_sync.c \
|
||||||
wire/wire_io.c \
|
wire/wire_io.c \
|
||||||
wire/fromwire.c \
|
wire/fromwire.c \
|
||||||
@@ -53,45 +60,34 @@ ifeq ($(EXPERIMENTAL_FEATURES),1)
|
|||||||
EXPERIMENTAL_PEER_PATCHES := $(sort $(wildcard wire/extracted_peer_experimental_*))
|
EXPERIMENTAL_PEER_PATCHES := $(sort $(wildcard wire/extracted_peer_experimental_*))
|
||||||
EXPERIMENTAL_ONION_PATCHES := $(sort $(wildcard wire/extracted_onion_experimental_*))
|
EXPERIMENTAL_ONION_PATCHES := $(sort $(wildcard wire/extracted_onion_experimental_*))
|
||||||
|
|
||||||
wire/gen_peer_wire_csv: wire/extracted_peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES)
|
wire/peer_wire.csv: wire/extracted_peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES)
|
||||||
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_PEER_PATCHES); do patch $@.$$$$ $$exp >/dev/null ; done; mv $@.$$$$ $@
|
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_PEER_PATCHES); do patch $@.$$$$ $$exp >/dev/null ; done; mv $@.$$$$ $@
|
||||||
|
|
||||||
wire/gen_onion_wire_csv: wire/extracted_onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES)
|
wire/onion_wire.csv: wire/extracted_onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES)
|
||||||
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_ONION_PATCHES); do patch $@.$$$$ $$exp; done >/dev/null ; mv $@.$$$$ $@
|
@set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_ONION_PATCHES); do patch $@.$$$$ $$exp; done >/dev/null ; mv $@.$$$$ $@
|
||||||
|
|
||||||
else # /* EXPERIMENTAL_FEATURES */
|
else # /* EXPERIMENTAL_FEATURES */
|
||||||
wire/gen_peer_wire_csv: wire/extracted_peer_wire_csv
|
wire/peer_wire.csv: wire/extracted_peer_wire_csv
|
||||||
@cp $< $@
|
@cp $< $@
|
||||||
|
|
||||||
wire/gen_onion_wire_csv: wire/extracted_onion_wire_csv
|
wire/onion_wire.csv: wire/extracted_onion_wire_csv
|
||||||
@cp $< $@
|
@cp $< $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# We (may) need to rebuild these if config changes
|
# We (may) need to rebuild these if config changes
|
||||||
wire/gen_peer_wire_csv wire/gen_onion_wire_csv: config.vars
|
wire/peer_wire.csv wire/onion_wire.csv: config.vars
|
||||||
|
|
||||||
# tlvs_n1 and n2 are used for test vectors, thus not referenced: expose them
|
# tlvs_n1 and n2 are used for test vectors, thus not referenced: expose them
|
||||||
# for testing and to prevent compile error about them being unused.
|
# for testing and to prevent compile error about them being unused.
|
||||||
# This will be easier if test vectors are moved to separate files.
|
# This will be easier if test vectors are moved to separate files.
|
||||||
wire/gen_peer_wire.h: wire/gen_peer_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
wire/peer_wiregen.h_args := --include='common/channel_id.h' --include='bitcoin/tx.h' --include='bitcoin/preimage.h' --include='bitcoin/short_channel_id.h' --include='common/node_id.h' --include='common/bigsize.h' --include='bitcoin/block.h' --include='bitcoin/privkey.h' -s --expose-tlv-type=n1 --expose-tlv-type=n2
|
||||||
$(BOLT_GEN) --include='common/channel_id.h' --include='bitcoin/tx.h' --include='bitcoin/preimage.h' --include='bitcoin/short_channel_id.h' --include='common/node_id.h' --include='common/bigsize.h' --include='bitcoin/block.h' --include='bitcoin/privkey.h' -s --expose-tlv-type=n1 --expose-tlv-type=n2 --page header $@ wire_type < $< > $@
|
|
||||||
|
|
||||||
wire/gen_peer_wire.c: wire/gen_peer_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
wire/peer_wiregen.c_args := -s --expose-tlv-type=n1 --expose-tlv-type=n2
|
||||||
$(BOLT_GEN) -s --expose-tlv-type=n1 --expose-tlv-type=n2 --page impl ${@:.c=.h} wire_type < $< > $@
|
|
||||||
|
|
||||||
# The tlv_payload isn't parsed in a fromwire, so we need to expose it.
|
# The tlv_payload isn't parsed in a fromwire, so we need to expose it.
|
||||||
wire/gen_onion_wire.h: wire/gen_onion_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
wire/onion_wiregen.h_args := --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' -s --expose-tlv-type=tlv_payload
|
||||||
$(BOLT_GEN) --include='bitcoin/short_channel_id.h' --include='bitcoin/privkey.h' --include='common/bigsize.h' --include='common/amount.h' --include='common/node_id.h' --include='bitcoin/block.h' -s --expose-tlv-type=tlv_payload --page header $@ onion_type < $< > $@
|
|
||||||
|
|
||||||
wire/gen_onion_wire.c: wire/gen_onion_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
wire/onion_wiregen.c_args := -s --expose-tlv-type=tlv_payload
|
||||||
$(BOLT_GEN) -s --expose-tlv-type=tlv_payload --page impl ${@:.c=.h} onion_type < $< > $@
|
|
||||||
|
|
||||||
# Some messages that are common among all daemons
|
|
||||||
wire/gen_common_wire.h: wire/common_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
|
||||||
$(BOLT_GEN) -s --page header $@ common_wire_type < $< > $@
|
|
||||||
|
|
||||||
wire/gen_common_wire.c: wire/common_wire_csv $(WIRE_BOLT_DEPS) wire/Makefile
|
|
||||||
$(BOLT_GEN) -s --page impl ${@:.c=.h} common_wire_type < $< > $@
|
|
||||||
|
|
||||||
check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS_NOGEN:%=check-hdr-include-order/%)
|
check-source: $(WIRE_SRC:%=check-src-include-order/%) $(WIRE_HEADERS_NOGEN:%=check-hdr-include-order/%)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include <bitcoin/block.h>
|
#include <bitcoin/block.h>
|
||||||
#include <wire/peer_wire.h>
|
#include <wire/peer_wire.h>
|
||||||
|
|
||||||
static bool unknown_type(enum wire_type t)
|
static bool unknown_type(enum peer_wire t)
|
||||||
{
|
{
|
||||||
switch (t) {
|
switch (t) {
|
||||||
case WIRE_INIT:
|
case WIRE_INIT:
|
||||||
@@ -42,7 +42,7 @@ static bool unknown_type(enum wire_type t)
|
|||||||
|
|
||||||
bool is_msg_for_gossipd(const u8 *cursor)
|
bool is_msg_for_gossipd(const u8 *cursor)
|
||||||
{
|
{
|
||||||
switch ((enum wire_type)fromwire_peektype(cursor)) {
|
switch ((enum peer_wire)fromwire_peektype(cursor)) {
|
||||||
case WIRE_CHANNEL_ANNOUNCEMENT:
|
case WIRE_CHANNEL_ANNOUNCEMENT:
|
||||||
case WIRE_NODE_ANNOUNCEMENT:
|
case WIRE_NODE_ANNOUNCEMENT:
|
||||||
case WIRE_CHANNEL_UPDATE:
|
case WIRE_CHANNEL_UPDATE:
|
||||||
@@ -83,7 +83,7 @@ bool is_msg_for_gossipd(const u8 *cursor)
|
|||||||
/* Return true if it's an unknown ODD message. cursor is a tal ptr. */
|
/* Return true if it's an unknown ODD message. cursor is a tal ptr. */
|
||||||
bool is_unknown_msg_discardable(const u8 *cursor)
|
bool is_unknown_msg_discardable(const u8 *cursor)
|
||||||
{
|
{
|
||||||
enum wire_type t = fromwire_peektype(cursor);
|
enum peer_wire t = fromwire_peektype(cursor);
|
||||||
return unknown_type(t) && (t & 1);
|
return unknown_type(t) && (t & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define LIGHTNING_WIRE_PEER_WIRE_H
|
#define LIGHTNING_WIRE_PEER_WIRE_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
/* BOLT #1:
|
/* BOLT #1:
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ ALL_TEST_PROGRAMS += $(WIRE_TEST_PROGRAMS)
|
|||||||
|
|
||||||
wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%)
|
wire-tests: $(WIRE_TEST_PROGRAMS:%=unittest/%)
|
||||||
|
|
||||||
wire/test/run-peer-wire: wire/gen_peer_wire.o common/bigsize.o
|
wire/test/run-peer-wire: wire/peer_wiregen.o common/bigsize.o
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <common/bigsize.h>
|
#include <common/bigsize.h>
|
||||||
#include <bitcoin/chainparams.h>
|
#include <bitcoin/chainparams.h>
|
||||||
#include <common/sphinx.h>
|
#include <common/sphinx.h>
|
||||||
#include <wire/gen_peer_wire.h>
|
#include <wire/peer_wiregen.h>
|
||||||
|
|
||||||
extern secp256k1_context *secp256k1_ctx;
|
extern secp256k1_context *secp256k1_ctx;
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ static const char *reason;
|
|||||||
#include <common/bigsize.c>
|
#include <common/bigsize.c>
|
||||||
#include <common/node_id.c>
|
#include <common/node_id.c>
|
||||||
|
|
||||||
#include <wire/gen_peer_wire.c>
|
#include <wire/peer_wiregen.c>
|
||||||
#include <wire/fromwire.c>
|
#include <wire/fromwire.c>
|
||||||
#include <wire/towire.c>
|
#include <wire/towire.c>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user