diff --git a/lightningd/channel/channel.c b/lightningd/channel/channel.c index c31ac8dd9..1fd934292 100644 --- a/lightningd/channel/channel.c +++ b/lightningd/channel/channel.c @@ -39,6 +39,7 @@ struct peer { struct channel_config conf[NUM_SIDES]; struct pubkey next_per_commit[NUM_SIDES]; bool funding_locked[NUM_SIDES]; + struct pubkey funding_pubkey[NUM_SIDES]; /* Their sig for current commit. */ secp256k1_ecdsa_signature their_commit_sig; @@ -58,6 +59,7 @@ struct peer { int gossip_client_fd; struct daemon_conn gossip_client; + struct pubkey node_ids[NUM_SIDES]; }; static void queue_pkt(struct peer *peer, const u8 *msg) @@ -162,7 +164,6 @@ int main(int argc, char *argv[]) struct peer *peer = tal(NULL, struct peer); struct privkey seed; struct basepoints points[NUM_SIDES]; - struct pubkey funding_pubkey[NUM_SIDES]; u32 feerate; u64 funding_satoshi, push_msat; u16 funding_txout; @@ -194,14 +195,16 @@ int main(int argc, char *argv[]) &peer->conf[LOCAL], &peer->conf[REMOTE], &peer->their_commit_sig, &peer->pcs.cs, - &funding_pubkey[REMOTE], + &peer->funding_pubkey[REMOTE], &points[REMOTE].revocation, &points[REMOTE].payment, &points[REMOTE].delayed_payment, &peer->next_per_commit[REMOTE], &am_funder, &feerate, &funding_satoshi, &push_msat, - &seed)) + &seed, + &peer->node_ids[LOCAL], + &peer->node_ids[REMOTE])) status_failed(WIRE_CHANNEL_BAD_COMMAND, "%s", tal_hex(msg, msg)); tal_free(msg); @@ -216,7 +219,7 @@ int main(int argc, char *argv[]) "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], + derive_basepoints(&seed, &peer->funding_pubkey[LOCAL], &points[LOCAL], &peer->our_secrets, &peer->shaseed, &peer->next_per_commit[LOCAL], 1); diff --git a/lightningd/channel/channel_wire.csv b/lightningd/channel/channel_wire.csv index 670ec5c6c..6a3260b38 100644 --- a/lightningd/channel/channel_wire.csv +++ b/lightningd/channel/channel_wire.csv @@ -35,6 +35,8 @@ channel_init,476,feerate,4 channel_init,480,funding_satoshi,8 channel_init,488,push_msat,8 channel_init,496,seed,32,struct privkey +channel_init,529,local_node_id,33,struct pubkey +channel_init,562,remote_node_id,33,struct pubkey # Tx is deep enough, go! channel_funding_locked,2 diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 7084385a4..7e897290e 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -665,7 +665,9 @@ static void peer_start_channeld(struct peer *peer, bool am_funder, 15000, peer->funding_satoshi, peer->push_msat, - peer->seed); + peer->seed, + &peer->ld->dstate.id, + peer->id); /* We don't expect a response: we are triggered by funding_depth_cb. */ subd_send_msg(peer->owner, take(msg));