Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connectd demux part 2 #4985

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a9e6692
lightningd: start gossipd after channels are loaded.
rustyrussell Jan 24, 2022
627404a
gossipd: infrastructure to tell lightningd about local channel updates.
rustyrussell Jan 24, 2022
5a9e8f3
gossipd: feed lightningd the channel_updates as soon as we make them.
rustyrussell Jan 24, 2022
34e1038
lightningd: tell gossipd when we use the channel_update.
rustyrussell Jan 24, 2022
24fc4d4
lightningd: use our cached channel_update for errors instead of askin…
rustyrussell Jan 24, 2022
042a6ed
channeld: keep local copy of latest channel_update for errors.
rustyrussell Jan 24, 2022
cff1d7e
channeld: send channel updates and announcements via lightningd.
rustyrussell Jan 24, 2022
4ca14eb
channeld: pause before sending initial channel_update.
rustyrussell Jan 24, 2022
6a17c89
dualopend: tell lightningd about new channel as soon as it's locked in.
rustyrussell Jan 24, 2022
95b0dec
connectd: temporarily have two fds to gossipd.
rustyrussell Jan 24, 2022
5b7cccf
gossipd: add routines to send gossip messages to and from connectd.
rustyrussell Jan 24, 2022
4b48a40
connectd: divert gossip messages directly to gossipd.
rustyrussell Jan 24, 2022
4c9e67c
gossipd: send all gossip msgs directly to connectd, not peer.
rustyrussell Jan 24, 2022
bc18acf
pytest: ignore pings when doing query_gossip.
rustyrussell Jan 29, 2022
b4c45af
connectd: handle pings and pongs.
rustyrussell Jan 29, 2022
fb2d208
connectd: handle onion messages.
rustyrussell Jan 29, 2022
de82e39
connectd: do io logging properly for msgs we make.
rustyrussell Jan 29, 2022
c7ec0a3
common: make sure we hand through peer for io logging.
rustyrussell Jan 29, 2022
8ffb126
connectd: handle custom messages.
rustyrussell Jan 29, 2022
cee59bc
channeld: simply exit if hsmd vanishes.
rustyrussell Jan 29, 2022
8d6d86d
subdaemons: remove gossipd fd from per-peer daemons.
rustyrussell Jan 29, 2022
5dea211
gossipd: don't hand out fds.
rustyrussell Jan 29, 2022
cd61786
connectd: remove second gossip fd.
rustyrussell Jan 29, 2022
9b51d5b
connectd: don't received useless peer fd if we're told to send final …
rustyrussell Jan 29, 2022
18e1dea
gossip_store: handle compacted gossip_store correctly.
rustyrussell Jan 29, 2022
c77f6ed
pytest: remove flake in test_upgrade_statickey_onchaind
rustyrussell Jan 29, 2022
e2e6fb4
pytest: make test_gossip_no_empty_announcements more robust.
rustyrussell Jan 29, 2022
1c95e02
pytest: protect against bad gossip messages from mining confirms too …
rustyrussell Jan 30, 2022
63f9344
gossipd: fix longstanding logic error in gossip_generation.
rustyrussell Jan 30, 2022
dfb78eb
lightningd: clean up subds before freeing HTLCs.
rustyrussell Jan 30, 2022
93f8a11
dual_funding: don't steal inflight field in update_channel_from_infli…
rustyrussell Jan 30, 2022
333b0e8
pytest: make test_mpp_adaptive more reliable
rustyrussell Jan 31, 2022
7530018
pytest: note unfixable test_htlc_rexmit_while_closing test.
rustyrussell Jan 31, 2022
73e325c
misc: clarifications from cdecker review.
rustyrussell Feb 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connectd/connectd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@ static struct io_plan *recv_gossip(struct io_conn *conn,

peer = peer_htable_get(&daemon->peers, &dst);
if (peer)
queue_peer_msg(peer, take(gossip_msg));
inject_peer_msg(peer, take(gossip_msg));

return daemon_conn_read_next(conn, daemon->gossipd);
}
Expand Down
11 changes: 6 additions & 5 deletions connectd/multiplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@
#include <wire/wire_io.h>
#include <wire/wire_sync.h>

void queue_peer_msg(struct peer *peer, const u8 *msg TAKES)
void inject_peer_msg(struct peer *peer, const u8 *msg TAKES)
{
status_peer_io(LOG_IO_OUT, &peer->id, msg);
msg_enqueue(peer->peer_outq, msg);
}

Expand Down Expand Up @@ -360,7 +361,7 @@ static void send_ping(struct peer *peer)
return;
}

queue_peer_msg(peer, take(make_ping(NULL, 1, 0)));
inject_peer_msg(peer, take(make_ping(NULL, 1, 0)));
peer->expecting_pong = PONG_EXPECTED_PROBING;
set_ping_timer(peer);
}
Expand All @@ -378,7 +379,7 @@ static void handle_ping_in(struct peer *peer, const u8 *msg)
}

if (pong)
queue_peer_msg(peer, take(pong));
inject_peer_msg(peer, take(pong));
}

static void handle_ping_reply(struct peer *peer, const u8 *msg)
Expand Down Expand Up @@ -582,7 +583,7 @@ static struct io_plan *read_from_subd_done(struct io_conn *subd_conn,
struct peer *peer)
{
/* Tell them to encrypt & write. */
queue_peer_msg(peer, take(peer->subd_in));
msg_enqueue(peer->peer_outq, take(peer->subd_in));
peer->subd_in = NULL;

/* Wait for them to wake us */
Expand Down Expand Up @@ -828,7 +829,7 @@ void send_manual_ping(struct daemon *daemon, const u8 *msg)
if (tal_count(ping) > 65535)
status_failed(STATUS_FAIL_MASTER_IO, "Oversize ping");

queue_peer_msg(peer, take(ping));
inject_peer_msg(peer, take(ping));

status_debug("sending ping expecting %sresponse",
num_pong_bytes >= 65532 ? "no " : "");
Expand Down
5 changes: 3 additions & 2 deletions connectd/multiplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ struct io_plan *multiplex_peer_setup(struct io_conn *peer_conn,
void multiplex_final_msg(struct peer *peer,
const u8 *final_msg TAKES);

/* Inject a message into the output stream */
void queue_peer_msg(struct peer *peer, const u8 *msg TAKES);
/* Inject a message into the output stream. Unlike a raw msg_enqueue,
* this does io logging if required. */
rustyrussell marked this conversation as resolved.
Show resolved Hide resolved
void inject_peer_msg(struct peer *peer, const u8 *msg TAKES);

void setup_peer_gossip_store(struct peer *peer,
const struct feature_set *our_features,
Expand Down
30 changes: 15 additions & 15 deletions connectd/onion_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void handle_obs2_onion_message(struct daemon *daemon,

/* FIXME: ratelimit! */
if (!fromwire_obs2_onion_message(msg, msg, &blinding, &onion)) {
queue_peer_msg(peer,
towire_warningfmt(NULL, NULL,
"Bad onion_message"));
inject_peer_msg(peer,
towire_warningfmt(NULL, NULL,
"Bad onion_message"));
return;
}

Expand Down Expand Up @@ -161,10 +161,10 @@ void handle_obs2_onion_message(struct daemon *daemon,
&next_node));
return;
}
queue_peer_msg(next_peer,
take(towire_obs2_onion_message(NULL,
&next_blinding,
serialize_onionpacket(tmpctx, rs->next))));
inject_peer_msg(next_peer,
take(towire_obs2_onion_message(NULL,
&next_blinding,
serialize_onionpacket(tmpctx, rs->next))));
}
}

Expand All @@ -188,7 +188,7 @@ void onionmsg_req(struct daemon *daemon, const u8 *msg)
omsg = towire_obs2_onion_message(NULL, &blinding, onionmsg);
else
omsg = towire_onion_message(NULL, &blinding, onionmsg);
queue_peer_msg(peer, take(omsg));
inject_peer_msg(peer, take(omsg));
}
}

Expand All @@ -213,9 +213,9 @@ void handle_onion_message(struct daemon *daemon,

/* FIXME: ratelimit! */
if (!fromwire_onion_message(msg, msg, &blinding, &onion)) {
queue_peer_msg(peer,
towire_warningfmt(NULL, NULL,
"Bad onion_message"));
inject_peer_msg(peer,
towire_warningfmt(NULL, NULL,
"Bad onion_message"));
return;
}

Expand Down Expand Up @@ -336,10 +336,10 @@ void handle_onion_message(struct daemon *daemon,
&next_node));
return;
}
queue_peer_msg(next_peer,
take(towire_onion_message(NULL,
&next_blinding,
serialize_onionpacket(tmpctx, rs->next))));
inject_peer_msg(next_peer,
take(towire_onion_message(NULL,
&next_blinding,
serialize_onionpacket(tmpctx, rs->next))));
}
}

6 changes: 3 additions & 3 deletions connectd/test/run-onion_message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 inject_peer_msg */
void inject_peer_msg(struct peer *peer UNNEEDED, const u8 *msg TAKES UNNEEDED)
{ fprintf(stderr, "inject_peer_msg called!\n"); abort(); }
/* Generated stub for master_badmsg */
void master_badmsg(u32 type_expected UNNEEDED, const u8 *msg)
{ fprintf(stderr, "master_badmsg called!\n"); abort(); }
Expand All @@ -100,9 +103,6 @@ void node_id_from_pubkey(struct node_id *id UNNEEDED, const struct pubkey *key U
/* Generated stub for pubkey_from_node_id */
bool pubkey_from_node_id(struct pubkey *key UNNEEDED, const struct node_id *id UNNEEDED)
{ fprintf(stderr, "pubkey_from_node_id called!\n"); abort(); }
/* Generated stub for queue_peer_msg */
void queue_peer_msg(struct peer *peer UNNEEDED, const u8 *msg TAKES UNNEEDED)
{ fprintf(stderr, "queue_peer_msg called!\n"); abort(); }
/* Generated stub for status_fmt */
void status_fmt(enum log_level level UNNEEDED,
const struct node_id *peer UNNEEDED,
Expand Down