Browse Source

channel: Passing through the endpoint node_ids

This is used to generate the announcements.
ppa-0.6.1
Christian Decker 8 years ago
committed by Rusty Russell
parent
commit
5a1fbb7aaf
  1. 11
      lightningd/channel/channel.c
  2. 2
      lightningd/channel/channel_wire.csv
  3. 4
      lightningd/peer_control.c

11
lightningd/channel/channel.c

@ -39,6 +39,7 @@ struct peer {
struct channel_config conf[NUM_SIDES]; struct channel_config conf[NUM_SIDES];
struct pubkey next_per_commit[NUM_SIDES]; struct pubkey next_per_commit[NUM_SIDES];
bool funding_locked[NUM_SIDES]; bool funding_locked[NUM_SIDES];
struct pubkey funding_pubkey[NUM_SIDES];
/* Their sig for current commit. */ /* Their sig for current commit. */
secp256k1_ecdsa_signature their_commit_sig; secp256k1_ecdsa_signature their_commit_sig;
@ -58,6 +59,7 @@ struct peer {
int gossip_client_fd; int gossip_client_fd;
struct daemon_conn gossip_client; struct daemon_conn gossip_client;
struct pubkey node_ids[NUM_SIDES];
}; };
static void queue_pkt(struct peer *peer, const u8 *msg) 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 peer *peer = tal(NULL, struct peer);
struct privkey seed; struct privkey seed;
struct basepoints points[NUM_SIDES]; struct basepoints points[NUM_SIDES];
struct pubkey funding_pubkey[NUM_SIDES];
u32 feerate; u32 feerate;
u64 funding_satoshi, push_msat; u64 funding_satoshi, push_msat;
u16 funding_txout; u16 funding_txout;
@ -194,14 +195,16 @@ int main(int argc, char *argv[])
&peer->conf[LOCAL], &peer->conf[REMOTE], &peer->conf[LOCAL], &peer->conf[REMOTE],
&peer->their_commit_sig, &peer->their_commit_sig,
&peer->pcs.cs, &peer->pcs.cs,
&funding_pubkey[REMOTE], &peer->funding_pubkey[REMOTE],
&points[REMOTE].revocation, &points[REMOTE].revocation,
&points[REMOTE].payment, &points[REMOTE].payment,
&points[REMOTE].delayed_payment, &points[REMOTE].delayed_payment,
&peer->next_per_commit[REMOTE], &peer->next_per_commit[REMOTE],
&am_funder, &am_funder,
&feerate, &funding_satoshi, &push_msat, &feerate, &funding_satoshi, &push_msat,
&seed)) &seed,
&peer->node_ids[LOCAL],
&peer->node_ids[REMOTE]))
status_failed(WIRE_CHANNEL_BAD_COMMAND, "%s", status_failed(WIRE_CHANNEL_BAD_COMMAND, "%s",
tal_hex(msg, msg)); tal_hex(msg, msg));
tal_free(msg); tal_free(msg);
@ -216,7 +219,7 @@ int main(int argc, char *argv[])
"Did not receive a valid client socket to gossipd"); "Did not receive a valid client socket to gossipd");
/* We derive everything from the one secret seed. */ /* 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->our_secrets, &peer->shaseed,
&peer->next_per_commit[LOCAL], 1); &peer->next_per_commit[LOCAL], 1);

2
lightningd/channel/channel_wire.csv

@ -35,6 +35,8 @@ channel_init,476,feerate,4
channel_init,480,funding_satoshi,8 channel_init,480,funding_satoshi,8
channel_init,488,push_msat,8 channel_init,488,push_msat,8
channel_init,496,seed,32,struct privkey 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! # Tx is deep enough, go!
channel_funding_locked,2 channel_funding_locked,2

Can't render this file because it has a wrong number of fields in line 2.

4
lightningd/peer_control.c

@ -665,7 +665,9 @@ static void peer_start_channeld(struct peer *peer, bool am_funder,
15000, 15000,
peer->funding_satoshi, peer->funding_satoshi,
peer->push_msat, 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. */ /* We don't expect a response: we are triggered by funding_depth_cb. */
subd_send_msg(peer->owner, take(msg)); subd_send_msg(peer->owner, take(msg));

Loading…
Cancel
Save