channel: Passing gossipd client fd to channeld

This commit is contained in:
Christian Decker 2017-03-09 16:08:57 +01:00
parent 3045e25624
commit 34c96399b0
3 changed files with 10 additions and 1 deletions

View File

@ -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],

View File

@ -16,7 +16,8 @@ channel_normal_operation,1001
#include <lightningd/cryptomsg.h>
#include <lightningd/channel_config.h>
# 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

1 # Shouldn't happen
16 channel_init,1 # gossipd-client fd)
17 channel_init,0,funding_txid,32,struct sha256_double channel_init,1
18 channel_init,32,funding_txout,2 channel_init,0,funding_txid,32,struct sha256_double
19 channel_init,34,our_config,36,struct channel_config channel_init,32,funding_txout,2
20 channel_init,34,our_config,36,struct channel_config
21 channel_init,70,their_config,36,struct channel_config
22 channel_init,106,first_commit_sig,64,secp256k1_ecdsa_signature
23 channel_init,166,crypto_state,144,struct crypto_state

View File

@ -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,