mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-17 04:44:22 +01:00
peer_exchange: set, read and log remote_addr
Changelog-Added: Protocol: set remote_addr on init tlvs
This commit is contained in:
committed by
Rusty Russell
parent
03a1df074a
commit
38e2abf68a
@@ -30,6 +30,9 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for status_fmt */
|
||||
void status_fmt(enum log_level level UNNEEDED,
|
||||
const struct node_id *peer UNNEEDED,
|
||||
@@ -45,6 +48,9 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
/* bitcoind loves its backwards txids! */
|
||||
|
||||
@@ -16,6 +16,9 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for memleak_add_helper_ */
|
||||
void memleak_add_helper_(const tal_t *p UNNEEDED, void (*cb)(struct htable *memtable UNNEEDED,
|
||||
const tal_t *)){ }
|
||||
@@ -32,6 +35,9 @@ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
void status_fmt(enum log_level level UNUSED,
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <common/json_stream.h>
|
||||
#include <common/node_id.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
@@ -77,6 +78,9 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_member */
|
||||
void json_add_member(struct json_stream *js UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
@@ -109,6 +113,9 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for version_and_exit */
|
||||
char *version_and_exit(const void *unused UNNEEDED)
|
||||
{ fprintf(stderr, "version_and_exit called!\n"); abort(); }
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <common/json_stream.h>
|
||||
#include <common/node_id.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
@@ -77,6 +78,9 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_member */
|
||||
void json_add_member(struct json_stream *js UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
@@ -109,6 +113,9 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for version_and_exit */
|
||||
char *version_and_exit(const void *unused UNNEEDED)
|
||||
{ fprintf(stderr, "version_and_exit called!\n"); abort(); }
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <common/json_stream.h>
|
||||
#include <common/node_id.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -80,6 +81,9 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_member */
|
||||
void json_add_member(struct json_stream *js UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
@@ -112,6 +116,9 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for version_and_exit */
|
||||
char *version_and_exit(const void *unused UNNEEDED)
|
||||
{ fprintf(stderr, "version_and_exit called!\n"); abort(); }
|
||||
|
||||
@@ -20,9 +20,9 @@ ALL_TEST_PROGRAMS += $(COMMON_TEST_PROGRAMS)
|
||||
|
||||
# Sphinx test wants to decode TLVs.
|
||||
common/test/run-sphinx: wire/onion$(EXP)_wiregen.o wire/towire.o wire/fromwire.o
|
||||
common/test/run-blindedpath_enctlv common/test/run-blindedpath_onion: wire/onion$(EXP)_wiregen.o wire/peer$(EXP)_wiregen.o wire/towire.o wire/fromwire.o wire/tlvstream.o
|
||||
common/test/run-blindedpath_enctlv common/test/run-blindedpath_onion: common/base32.o common/wireaddr.o wire/onion$(EXP)_wiregen.o wire/peer$(EXP)_wiregen.o wire/towire.o wire/fromwire.o wire/tlvstream.o
|
||||
common/test/run-route_blinding_test: wire/onion$(EXP)_wiregen.o wire/peer$(EXP)_wiregen.o wire/towire.o wire/fromwire.o wire/tlvstream.o common/json.o common/json_helpers.o
|
||||
common/test/run-route_blinding_override_test: wire/onion$(EXP)_wiregen.o wire/peer$(EXP)_wiregen.o wire/towire.o wire/fromwire.o wire/tlvstream.o common/json.o common/json_helpers.o
|
||||
common/test/run-route_blinding_override_test: common/base32.o common/wireaddr.o wire/onion$(EXP)_wiregen.o wire/peer$(EXP)_wiregen.o wire/towire.o wire/fromwire.o wire/tlvstream.o common/json.o common/json_helpers.o
|
||||
|
||||
common/test/run-param \
|
||||
common/test/run-json: \
|
||||
@@ -35,8 +35,8 @@ common/test/run-json: \
|
||||
common/lease_rates.o \
|
||||
common/node_id.o \
|
||||
common/pseudorand.o \
|
||||
common/wireaddr.o \
|
||||
common/type_to_string.o \
|
||||
common/wireaddr.o \
|
||||
wire/fromwire.o \
|
||||
wire/onion$(EXP)_wiregen.o \
|
||||
wire/peer$(EXP)_wiregen.o \
|
||||
@@ -55,6 +55,8 @@ common/test/run-route common/test/run-route-specific: \
|
||||
wire/towire.o
|
||||
|
||||
common/test/run-gossmap_local: \
|
||||
common/base32.o \
|
||||
common/wireaddr.o \
|
||||
wire/fromwire.o \
|
||||
wire/peer$(EXP)_wiregen.o \
|
||||
wire/tlvstream.o \
|
||||
@@ -63,16 +65,21 @@ common/test/run-gossmap_local: \
|
||||
common/test/run-bolt12_merkle: \
|
||||
common/amount.o \
|
||||
common/bigsize.o \
|
||||
common/base32.o \
|
||||
common/bech32.o \
|
||||
common/bech32_util.o \
|
||||
common/bolt12.o \
|
||||
common/node_id.o \
|
||||
common/type_to_string.o \
|
||||
common/wireaddr.o \
|
||||
wire/bolt12$(EXP)_wiregen.o \
|
||||
wire/fromwire.o \
|
||||
wire/tlvstream.o \
|
||||
wire/peer$(EXP)_wiregen.o \
|
||||
wire/towire.o
|
||||
|
||||
common/test/run-bolt12_merkle-json: \
|
||||
common/base32.o \
|
||||
common/wireaddr.o
|
||||
|
||||
check-units: $(COMMON_TEST_PROGRAMS:%=unittest/%)
|
||||
|
||||
@@ -33,6 +33,9 @@ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
void *record UNNEEDED, struct tlv_field **fields UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_tlv called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for tlv_fields_valid */
|
||||
bool tlv_fields_valid(const struct tlv_field *fields UNNEEDED, u64 *allow_extra UNNEEDED,
|
||||
size_t *err_index UNNEEDED)
|
||||
@@ -48,6 +51,9 @@ void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
const void *record UNNEEDED)
|
||||
{ fprintf(stderr, "towire_tlv called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for type_to_string_ */
|
||||
const char *type_to_string_(const tal_t *ctx UNNEEDED, const char *typename UNNEEDED,
|
||||
union printable_types u UNNEEDED)
|
||||
|
||||
@@ -26,6 +26,9 @@ bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
void *record UNNEEDED, struct tlv_field **fields UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_tlv called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for tlv_fields_valid */
|
||||
bool tlv_fields_valid(const struct tlv_field *fields UNNEEDED, u64 *allow_extra UNNEEDED,
|
||||
size_t *err_index UNNEEDED)
|
||||
@@ -41,6 +44,9 @@ void towire_tlv(u8 **pptr UNNEEDED,
|
||||
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
|
||||
const void *record UNNEEDED)
|
||||
{ fprintf(stderr, "towire_tlv called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for type_to_string_ */
|
||||
const char *type_to_string_(const tal_t *ctx UNNEEDED, const char *typename UNNEEDED,
|
||||
union printable_types u UNNEEDED)
|
||||
|
||||
@@ -53,9 +53,6 @@ struct amount_asset amount_sat_to_asset(struct amount_sat *sat UNNEEDED, const u
|
||||
/* Generated stub for amount_tx_fee */
|
||||
struct amount_sat amount_tx_fee(u32 fee_per_kw UNNEEDED, size_t weight UNNEEDED)
|
||||
{ fprintf(stderr, "amount_tx_fee called!\n"); abort(); }
|
||||
/* Generated stub for fmt_wireaddr_without_port */
|
||||
char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
|
||||
{ fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_amount_msat */
|
||||
struct amount_msat fromwire_amount_msat(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_amount_msat called!\n"); abort(); }
|
||||
|
||||
@@ -69,6 +69,9 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_member */
|
||||
void json_add_member(struct json_stream *js UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
@@ -106,6 +109,9 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
static u8 *json_to_enctlvs(const tal_t *ctx,
|
||||
|
||||
@@ -287,6 +287,11 @@ char *fmt_wireaddr(const tal_t *ctx, const struct wireaddr *a)
|
||||
}
|
||||
REGISTER_TYPE_TO_STRING(wireaddr, fmt_wireaddr);
|
||||
|
||||
char *printwire_wireaddr(const tal_t *ctx, const struct wireaddr *a)
|
||||
{
|
||||
return fmt_wireaddr(ctx, a);
|
||||
}
|
||||
|
||||
/* Valid forms:
|
||||
*
|
||||
* [anything]:<number>
|
||||
|
||||
@@ -92,6 +92,7 @@ bool parse_wireaddr(const char *arg, struct wireaddr *addr, u16 port,
|
||||
|
||||
char *fmt_wireaddr(const tal_t *ctx, const struct wireaddr *a);
|
||||
char *fmt_wireaddr_without_port(const tal_t *ctx, const struct wireaddr *a);
|
||||
char *printwire_wireaddr(const tal_t *ctx, const struct wireaddr *a);
|
||||
|
||||
/* If no_dns is non-NULL, we will set it to true and return NULL if
|
||||
* we wanted to do a DNS lookup. */
|
||||
|
||||
@@ -215,6 +215,7 @@ struct peer_reconnected {
|
||||
struct daemon *daemon;
|
||||
struct node_id id;
|
||||
struct wireaddr_internal addr;
|
||||
const struct wireaddr *remote_addr;
|
||||
struct crypto_state cs;
|
||||
const u8 *their_features;
|
||||
bool incoming;
|
||||
@@ -233,8 +234,9 @@ static struct io_plan *retry_peer_connected(struct io_conn *conn,
|
||||
|
||||
/*~ Usually the pattern is to return this directly, but we have to free
|
||||
* our temporary structure. */
|
||||
plan = peer_connected(conn, pr->daemon, &pr->id, &pr->addr, &pr->cs,
|
||||
take(pr->their_features), pr->incoming);
|
||||
plan = peer_connected(conn, pr->daemon, &pr->id, &pr->addr,
|
||||
pr->remote_addr,
|
||||
&pr->cs, take(pr->their_features), pr->incoming);
|
||||
tal_free(pr);
|
||||
return plan;
|
||||
}
|
||||
@@ -245,6 +247,7 @@ static struct io_plan *peer_reconnected(struct io_conn *conn,
|
||||
struct daemon *daemon,
|
||||
const struct node_id *id,
|
||||
const struct wireaddr_internal *addr,
|
||||
const struct wireaddr *remote_addr,
|
||||
const struct crypto_state *cs,
|
||||
const u8 *their_features TAKES,
|
||||
bool incoming)
|
||||
@@ -264,6 +267,7 @@ static struct io_plan *peer_reconnected(struct io_conn *conn,
|
||||
pr->id = *id;
|
||||
pr->cs = *cs;
|
||||
pr->addr = *addr;
|
||||
pr->remote_addr = remote_addr;
|
||||
pr->incoming = incoming;
|
||||
|
||||
/*~ Note that tal_dup_talarr() will do handle the take() of features
|
||||
@@ -335,6 +339,7 @@ struct io_plan *peer_connected(struct io_conn *conn,
|
||||
struct daemon *daemon,
|
||||
const struct node_id *id,
|
||||
const struct wireaddr_internal *addr,
|
||||
const struct wireaddr *remote_addr,
|
||||
struct crypto_state *cs,
|
||||
const u8 *their_features TAKES,
|
||||
bool incoming)
|
||||
@@ -348,7 +353,7 @@ struct io_plan *peer_connected(struct io_conn *conn,
|
||||
|
||||
peer = peer_htable_get(&daemon->peers, id);
|
||||
if (peer)
|
||||
return peer_reconnected(conn, daemon, id, addr, cs,
|
||||
return peer_reconnected(conn, daemon, id, addr, remote_addr, cs,
|
||||
their_features, incoming);
|
||||
|
||||
/* We promised we'd take it by marking it TAKEN above; prepare to free it. */
|
||||
@@ -413,8 +418,8 @@ struct io_plan *peer_connected(struct io_conn *conn,
|
||||
setup_peer_gossip_store(peer, daemon->our_features, their_features);
|
||||
|
||||
/* Create message to tell master peer has connected. */
|
||||
msg = towire_connectd_peer_connected(NULL, id, addr, incoming,
|
||||
their_features);
|
||||
msg = towire_connectd_peer_connected(NULL, id, addr, remote_addr,
|
||||
incoming, their_features);
|
||||
|
||||
/*~ daemon_conn is a message queue for inter-daemon communication: we
|
||||
* queue up the `connect_peer_connected` message to tell lightningd
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <common/crypto_state.h>
|
||||
#include <common/node_id.h>
|
||||
#include <common/pseudorand.h>
|
||||
#include <common/wireaddr.h>
|
||||
|
||||
struct io_conn;
|
||||
struct connecting;
|
||||
@@ -199,6 +200,7 @@ struct io_plan *peer_connected(struct io_conn *conn,
|
||||
struct daemon *daemon,
|
||||
const struct node_id *id,
|
||||
const struct wireaddr_internal *addr,
|
||||
const struct wireaddr *remote_addr,
|
||||
struct crypto_state *cs,
|
||||
const u8 *their_features TAKES,
|
||||
bool incoming);
|
||||
|
||||
@@ -64,6 +64,7 @@ msgdata,connectd_connect_failed,addrhint,?wireaddr_internal,
|
||||
msgtype,connectd_peer_connected,2002
|
||||
msgdata,connectd_peer_connected,id,node_id,
|
||||
msgdata,connectd_peer_connected,addr,wireaddr_internal,
|
||||
msgdata,connectd_peer_connected,remote_addr,?wireaddr,
|
||||
msgdata,connectd_peer_connected,incoming,bool,
|
||||
msgdata,connectd_peer_connected,flen,u16,
|
||||
msgdata,connectd_peer_connected,features,u8,flen
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include <common/wire_error.h>
|
||||
#include <connectd/connectd.h>
|
||||
#include <connectd/connectd_wiregen.h>
|
||||
#include <connectd/netaddress.h>
|
||||
#include <connectd/peer_exchange_initmsg.h>
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
@@ -47,6 +48,7 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
|
||||
u8 *msg = cryptomsg_decrypt_body(tmpctx, &peer->cs, peer->msg);
|
||||
u8 *globalfeatures, *features;
|
||||
struct tlv_init_tlvs *tlvs = tlv_init_tlvs_new(msg);
|
||||
struct wireaddr *remote_addr;
|
||||
|
||||
if (!msg)
|
||||
return io_close(conn);
|
||||
@@ -86,6 +88,28 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
|
||||
}
|
||||
}
|
||||
|
||||
/* fetch optional tlv `remote_addr` */
|
||||
remote_addr = NULL;
|
||||
/* BOLT-remote-address #1:
|
||||
* The receiving node:
|
||||
* ...
|
||||
* - MAY use the `remote_addr` to update its `node_annoucement`
|
||||
*/
|
||||
if (tlvs->remote_addr) {
|
||||
switch (tlvs->remote_addr->type) {
|
||||
case ADDR_TYPE_IPV4:
|
||||
case ADDR_TYPE_IPV6:
|
||||
remote_addr = tal_steal(peer, tlvs->remote_addr);
|
||||
break;
|
||||
/* We are only interested in IP addresses */
|
||||
case ADDR_TYPE_TOR_V2_REMOVED:
|
||||
case ADDR_TYPE_TOR_V3:
|
||||
case ADDR_TYPE_DNS:
|
||||
case ADDR_TYPE_WEBSOCKET:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The globalfeatures field is now unused, but there was a
|
||||
* window where it was: combine the two. */
|
||||
features = featurebits_or(tmpctx, take(features), globalfeatures);
|
||||
@@ -96,7 +120,9 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
|
||||
/* Usually return io_close_taken_fd, but may wait for old peer to
|
||||
* be disconnected if it's a reconnect. */
|
||||
return peer_connected(conn, peer->daemon, &peer->id,
|
||||
&peer->addr, &peer->cs,
|
||||
&peer->addr,
|
||||
remote_addr,
|
||||
&peer->cs,
|
||||
take(features),
|
||||
peer->incoming);
|
||||
}
|
||||
@@ -182,6 +208,32 @@ struct io_plan *peer_exchange_initmsg(struct io_conn *conn,
|
||||
tlvs->networks = tal_dup_arr(tlvs, struct bitcoin_blkid,
|
||||
&chainparams->genesis_blockhash, 1, 0);
|
||||
|
||||
/* set optional tlv `remote_addr` on incoming IP connections */
|
||||
tlvs->remote_addr = NULL;
|
||||
/* BOLT-remote-address #1:
|
||||
* The sending node:
|
||||
* ...
|
||||
* - SHOULD set `remote_addr` to reflect the remote IP address (and port) of an
|
||||
* incoming connection, if the node is the receiver and the connection was done
|
||||
* via IP.
|
||||
*/
|
||||
if (incoming && addr->itype == ADDR_INTERNAL_WIREADDR &&
|
||||
address_routable(&addr->u.wireaddr, true)) {
|
||||
switch (addr->u.wireaddr.type) {
|
||||
case ADDR_TYPE_IPV4:
|
||||
case ADDR_TYPE_IPV6:
|
||||
tlvs->remote_addr = tal(tlvs, struct wireaddr);
|
||||
*tlvs->remote_addr = addr->u.wireaddr;
|
||||
break;
|
||||
/* Only report IP addresses back for now */
|
||||
case ADDR_TYPE_TOR_V2_REMOVED:
|
||||
case ADDR_TYPE_TOR_V3:
|
||||
case ADDR_TYPE_DNS:
|
||||
case ADDR_TYPE_WEBSOCKET:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Initially, there were two sets of feature bits: global and local.
|
||||
* Local affected peer nodes only, global affected everyone. Both were
|
||||
* sent in the `init` message, but node_announcement only advertized
|
||||
|
||||
@@ -88,6 +88,9 @@ bool fromwire_connectd_send_onionmsg(const tal_t *ctx UNNEEDED, const void *p UN
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for inject_peer_msg */
|
||||
void inject_peer_msg(struct peer *peer UNNEEDED, const u8 *msg TAKES UNNEEDED)
|
||||
{ fprintf(stderr, "inject_peer_msg called!\n"); abort(); }
|
||||
@@ -166,6 +169,9 @@ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED,
|
||||
const struct channel_id *channel UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
/* Updated each time, as we pretend to be Alice, Bob, Carol */
|
||||
|
||||
@@ -65,6 +65,9 @@ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
||||
/* Generated stub for fmt_wireaddr_without_port */
|
||||
char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
|
||||
{ fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr_array */
|
||||
struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx UNNEEDED, const u8 *ser UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr_array called!\n"); abort(); }
|
||||
@@ -154,6 +157,9 @@ void status_fmt(enum log_level level UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
|
||||
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
||||
@@ -48,6 +48,9 @@ bool fromwire_hsmd_cupdate_sig_reply(const tal_t *ctx UNNEEDED, const void *p UN
|
||||
/* Generated stub for fromwire_hsmd_node_announcement_sig_reply */
|
||||
bool fromwire_hsmd_node_announcement_sig_reply(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_hsmd_node_announcement_sig_reply called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for get_node */
|
||||
struct node *get_node(struct routing_state *rstate UNNEEDED,
|
||||
const struct node_id *id UNNEEDED)
|
||||
|
||||
@@ -69,6 +69,9 @@ bool fromwire_hsmd_cupdate_sig_reply(const tal_t *ctx UNNEEDED, const void *p UN
|
||||
/* Generated stub for fromwire_hsmd_node_announcement_sig_reply */
|
||||
bool fromwire_hsmd_node_announcement_sig_reply(const void *p UNNEEDED, secp256k1_ecdsa_signature *signature UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_hsmd_node_announcement_sig_reply called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for get_node */
|
||||
struct node *get_node(struct routing_state *rstate UNNEEDED,
|
||||
const struct node_id *id UNNEEDED)
|
||||
|
||||
@@ -56,6 +56,9 @@ char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr
|
||||
/* Generated stub for fromwire_gossipd_dev_set_max_scids_encode_size */
|
||||
bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p UNNEEDED, u32 *max UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_gossipd_dev_set_max_scids_encode_size called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for get_cupdate_parts */
|
||||
void get_cupdate_parts(const u8 *channel_update UNNEEDED,
|
||||
const u8 *parts[2] UNNEEDED,
|
||||
@@ -107,6 +110,9 @@ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED,
|
||||
const struct channel_id *channel UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
void status_fmt(enum log_level level UNNEEDED,
|
||||
|
||||
@@ -32,6 +32,9 @@ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
||||
/* Generated stub for fmt_wireaddr_without_port */
|
||||
char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
|
||||
{ fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_member */
|
||||
void json_add_member(struct json_stream *js UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
@@ -93,6 +96,9 @@ void status_fmt(enum log_level level UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
|
||||
{ fprintf(stderr, "status_fmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for would_ratelimit_cupdate */
|
||||
bool would_ratelimit_cupdate(struct routing_state *rstate UNNEEDED,
|
||||
const struct half_chan *hc UNNEEDED,
|
||||
|
||||
@@ -36,6 +36,9 @@ void ecdh(const struct pubkey *point UNNEEDED, struct secret *ss UNNEEDED)
|
||||
/* Generated stub for fmt_wireaddr_without_port */
|
||||
char *fmt_wireaddr_without_port(const tal_t *ctx UNNEEDED, const struct wireaddr *a UNNEEDED)
|
||||
{ fprintf(stderr, "fmt_wireaddr_without_port called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr_array */
|
||||
struct wireaddr *fromwire_wireaddr_array(const tal_t *ctx UNNEEDED, const u8 *ser UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr_array called!\n"); abort(); }
|
||||
@@ -124,6 +127,9 @@ u8 *towire_warningfmt(const tal_t *ctx UNNEEDED,
|
||||
const struct channel_id *channel UNNEEDED,
|
||||
const char *fmt UNNEEDED, ...)
|
||||
{ fprintf(stderr, "towire_warningfmt called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
/* NOOP stub for gossip_store_new */
|
||||
|
||||
@@ -21,6 +21,7 @@ ALL_PROGRAMS += lightningd/lightning_hsmd
|
||||
HSMD_COMMON_OBJS := \
|
||||
common/amount.o \
|
||||
common/autodata.o \
|
||||
common/base32.o \
|
||||
common/bigsize.o \
|
||||
common/bip32.o \
|
||||
common/bolt12_merkle.o \
|
||||
@@ -46,7 +47,8 @@ HSMD_COMMON_OBJS := \
|
||||
common/type_to_string.o \
|
||||
common/utils.o \
|
||||
common/utxo.o \
|
||||
common/version.o
|
||||
common/version.o \
|
||||
common/wireaddr.o
|
||||
|
||||
lightningd/lightning_hsmd: $(HSMD_OBJS) $(HSMD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS)
|
||||
|
||||
|
||||
@@ -929,6 +929,7 @@ struct peer_connected_hook_payload {
|
||||
struct lightningd *ld;
|
||||
struct channel *channel;
|
||||
struct wireaddr_internal addr;
|
||||
struct wireaddr *remote_addr;
|
||||
bool incoming;
|
||||
struct peer *peer;
|
||||
struct peer_fd *peer_fd;
|
||||
@@ -946,6 +947,10 @@ peer_connected_serialize(struct peer_connected_hook_payload *payload,
|
||||
json_add_string(
|
||||
stream, "addr",
|
||||
type_to_string(stream, struct wireaddr_internal, &payload->addr));
|
||||
if (payload->remote_addr)
|
||||
json_add_string(
|
||||
stream, "remote_addr",
|
||||
type_to_string(stream, struct wireaddr, payload->remote_addr));
|
||||
json_add_hex_talarr(stream, "features", p->their_features);
|
||||
json_object_end(stream); /* .peer */
|
||||
}
|
||||
@@ -1121,6 +1126,7 @@ void peer_connected(struct lightningd *ld, const u8 *msg, int peer_fd)
|
||||
hook_payload->error = NULL;
|
||||
if (!fromwire_connectd_peer_connected(hook_payload, msg,
|
||||
&id, &hook_payload->addr,
|
||||
&hook_payload->remote_addr,
|
||||
&hook_payload->incoming,
|
||||
&their_features))
|
||||
fatal("Connectd gave bad CONNECT_PEER_CONNECTED message %s",
|
||||
@@ -1151,6 +1157,14 @@ void peer_connected(struct lightningd *ld, const u8 *msg, int peer_fd)
|
||||
if (!hook_payload->channel)
|
||||
hook_payload->channel = peer_unsaved_channel(peer);
|
||||
|
||||
/* Log remote_addr for now */
|
||||
if (hook_payload->remote_addr && (
|
||||
hook_payload->remote_addr->type == ADDR_TYPE_IPV4 ||
|
||||
hook_payload->remote_addr->type == ADDR_TYPE_IPV6)) {
|
||||
log_info(ld->log, "Peer says it sees our address as: %s",
|
||||
fmt_wireaddr(peer, hook_payload->remote_addr));
|
||||
}
|
||||
|
||||
plugin_hook_call_peer_connected(ld, hook_payload);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ ALL_TEST_PROGRAMS += $(LIGHTNINGD_TEST_PROGRAMS)
|
||||
LIGHTNINGD_TEST_COMMON_OBJS := \
|
||||
common/amount.o \
|
||||
common/autodata.o \
|
||||
common/base32.o \
|
||||
common/bech32.o \
|
||||
common/daemon_conn.o \
|
||||
common/htlc_state.o \
|
||||
@@ -23,7 +24,8 @@ LIGHTNINGD_TEST_COMMON_OBJS := \
|
||||
common/utils.o \
|
||||
common/utxo.o \
|
||||
common/type_to_string.o \
|
||||
common/permute_tx.o
|
||||
common/permute_tx.o \
|
||||
common/wireaddr.o \
|
||||
|
||||
$(LIGHTNINGD_TEST_PROGRAMS): $(CCAN_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) $(LIGHTNINGD_TEST_COMMON_OBJS)
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "config.h"
|
||||
#define main unused_main
|
||||
int unused_main(int argc, char *argv[]);
|
||||
#include "../../common/base32.c"
|
||||
#include "../../common/wireaddr.c"
|
||||
#include "../io_loop_with_timers.c"
|
||||
#include "../lightningd.c"
|
||||
#include "../subd.c"
|
||||
|
||||
@@ -202,7 +202,7 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_connectd_peer_connected */
|
||||
bool fromwire_connectd_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, bool *incoming UNNEEDED, u8 **features UNNEEDED)
|
||||
bool fromwire_connectd_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, struct wireaddr **remote_addr UNNEEDED, bool *incoming UNNEEDED, u8 **features UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_connectd_peer_connected called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_hsmd_sign_bolt12_reply */
|
||||
bool fromwire_hsmd_sign_bolt12_reply(const void *p UNNEEDED, struct bip340sig *sig UNNEEDED)
|
||||
|
||||
@@ -34,6 +34,7 @@ LIGHTNINGD_CONTROL_OBJS += \
|
||||
ONCHAIND_COMMON_OBJS := \
|
||||
common/amount.o \
|
||||
common/autodata.o \
|
||||
common/base32.o \
|
||||
common/bigsize.o \
|
||||
common/bip32.o \
|
||||
common/coin_mvt.o \
|
||||
@@ -63,7 +64,8 @@ ONCHAIND_COMMON_OBJS := \
|
||||
common/utils.o \
|
||||
common/utxo.o \
|
||||
common/version.o \
|
||||
common/wallet.o
|
||||
common/wallet.o \
|
||||
common/wireaddr.o
|
||||
|
||||
lightningd/lightning_onchaind: $(ONCHAIND_OBJS) $(WIRE_ONION_OBJS) $(ONCHAIND_COMMON_OBJS) $(WIRE_OBJS) $(BITCOIN_OBJS) $(HSMD_CLIENT_OBJS)
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ static u8 *psbt_changeset_get_next(const tal_t *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void shutdown(struct state *state)
|
||||
static void dualopen_shutdown(struct state *state)
|
||||
{
|
||||
u8 *msg = towire_dualopend_shutdown_complete(state);
|
||||
|
||||
@@ -1243,7 +1243,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state)
|
||||
handle_peer_shutdown(state, msg);
|
||||
/* If we're done, exit */
|
||||
if (shutdown_complete(state))
|
||||
shutdown(state);
|
||||
dualopen_shutdown(state);
|
||||
return NULL;
|
||||
case WIRE_INIT_RBF:
|
||||
case WIRE_OPEN_CHANNEL2:
|
||||
|
||||
@@ -15,6 +15,9 @@ bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
/* Generated stub for fromwire_node_id */
|
||||
void fromwire_node_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for towire_bigsize */
|
||||
void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
{ fprintf(stderr, "towire_bigsize called!\n"); abort(); }
|
||||
@@ -24,6 +27,9 @@ void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id U
|
||||
/* Generated stub for towire_node_id */
|
||||
void towire_node_id(u8 **pptr UNNEEDED, const struct node_id *id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_node_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
struct test_case {
|
||||
|
||||
@@ -24,6 +24,9 @@ bigsize_t fromwire_bigsize(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
|
||||
bool fromwire_channel_id(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
|
||||
struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_wireaddr */
|
||||
bool fromwire_wireaddr(const u8 **cursor UNNEEDED, size_t *max UNNEEDED, struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_wireaddr called!\n"); abort(); }
|
||||
/* Generated stub for json_add_amount_msat_compat */
|
||||
void json_add_amount_msat_compat(struct json_stream *result UNNEEDED,
|
||||
struct amount_msat msat UNNEEDED,
|
||||
@@ -224,6 +227,9 @@ void towire_bigsize(u8 **pptr UNNEEDED, const bigsize_t val UNNEEDED)
|
||||
/* Generated stub for towire_channel_id */
|
||||
void towire_channel_id(u8 **pptr UNNEEDED, const struct channel_id *channel_id UNNEEDED)
|
||||
{ fprintf(stderr, "towire_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for towire_wireaddr */
|
||||
void towire_wireaddr(u8 **pptr UNNEEDED, const struct wireaddr *addr UNNEEDED)
|
||||
{ fprintf(stderr, "towire_wireaddr called!\n"); abort(); }
|
||||
/* AUTOGENERATED MOCKS END */
|
||||
|
||||
#ifndef SUPERVERBOSE
|
||||
|
||||
@@ -126,7 +126,7 @@ bool fromwire_channeld_offer_htlc_reply(const tal_t *ctx UNNEEDED, const void *p
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *commitnum UNNEEDED, struct penalty_base **pbase UNNEEDED, struct fee_states **fee_states UNNEEDED, struct height_states **blockheight_states UNNEEDED, struct changed_htlc **changed UNNEEDED, struct bitcoin_signature *commit_sig UNNEEDED, struct bitcoin_signature **htlc_sigs UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_sending_commitsig called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_connectd_peer_connected */
|
||||
bool fromwire_connectd_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, bool *incoming UNNEEDED, u8 **features UNNEEDED)
|
||||
bool fromwire_connectd_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, struct wireaddr **remote_addr UNNEEDED, bool *incoming UNNEEDED, u8 **features UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_connectd_peer_connected called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_hsmd_get_output_scriptpubkey_reply */
|
||||
bool fromwire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u8 **script UNNEEDED)
|
||||
|
||||
@@ -7,7 +7,7 @@ msgdata,init,tlvs,init_tlvs,
|
||||
tlvtype,init_tlvs,networks,1
|
||||
tlvdata,init_tlvs,networks,chains,chain_hash,...
|
||||
tlvtype,init_tlvs,remote_addr,3
|
||||
tlvdata,init_tlvs,remote_addr,data,byte,...
|
||||
tlvdata,init_tlvs,remote_addr,remote_addr,wireaddr,
|
||||
msgtype,error,17
|
||||
msgdata,error,channel_id,channel_id,
|
||||
msgdata,error,len,u16,
|
||||
|
||||
|
@@ -11,9 +11,11 @@ ALL_TEST_PROGRAMS += $(WIRE_TEST_PROGRAMS)
|
||||
|
||||
WIRE_TEST_COMMON_OBJS := \
|
||||
common/autodata.o \
|
||||
common/base32.o \
|
||||
common/pseudorand.o \
|
||||
common/setup.o \
|
||||
common/utils.o
|
||||
common/utils.o \
|
||||
common/wireaddr.o
|
||||
|
||||
# run-tlvstream.c needs to reach into bitcoin/pubkey for SUPERVERBOSE
|
||||
$(WIRE_TEST_PROGRAMS): $(WIRE_TEST_COMMON_OBJS) $(filter-out bitcoin/pubkey.o bitcoin/chainparams.o,$(BITCOIN_OBJS))
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <common/channel_type.h>
|
||||
#include <common/setup.h>
|
||||
#include <common/sphinx.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <wire/tlvstream.c>
|
||||
|
||||
extern secp256k1_context *secp256k1_ctx;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <ccan/short_types/short_types.h>
|
||||
#include <ccan/tal/tal.h>
|
||||
#include <common/errcode.h>
|
||||
#include <common/wireaddr.h>
|
||||
#include <secp256k1_recovery.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user