diff --git a/lightningd/channel/channel.c b/lightningd/channel/channel.c index 43dc4180f..a5824328d 100644 --- a/lightningd/channel/channel.c +++ b/lightningd/channel/channel.c @@ -51,6 +51,8 @@ struct peer { u8 *req_in; const u8 **peer_out; + + int gossip_client_fd; }; static void msg_enqueue(const u8 ***q, const u8 *add) @@ -199,6 +201,11 @@ int main(int argc, char *argv[]) status_failed(WIRE_CHANNEL_BAD_COMMAND, "%s", tal_hex(msg, msg)); tal_free(msg); + peer->gossip_client_fd = fdpass_recv(REQ_FD); + if (peer->gossip_client_fd == -1) + status_failed( + WIRE_CHANNEL_BAD_COMMAND, + "Did not receive a valid client socket to gossipd"); /* We derive everything from the one secret seed. */ derive_basepoints(&seed, &funding_pubkey[LOCAL], &points[LOCAL], diff --git a/lightningd/channel/channel_wire.csv b/lightningd/channel/channel_wire.csv index 24c985d6d..670ec5c6c 100644 --- a/lightningd/channel/channel_wire.csv +++ b/lightningd/channel/channel_wire.csv @@ -16,7 +16,8 @@ channel_normal_operation,1001 #include #include -# Begin! You're still waiting for the tx to be buried though. +# Begin! You're still waiting for the tx to be buried though (passes +# gossipd-client fd) channel_init,1 channel_init,0,funding_txid,32,struct sha256_double channel_init,32,funding_txout,2 diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 8cf27d22e..7084385a4 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -669,6 +669,7 @@ static void peer_start_channeld(struct peer *peer, bool am_funder, /* We don't expect a response: we are triggered by funding_depth_cb. */ subd_send_msg(peer->owner, take(msg)); + subd_send_fd(peer->owner, peer->gossip_client_fd); } static bool opening_release_tx(struct subd *opening, const u8 *resp,