Browse Source

opening: Pass network_index through to openingd

This is needed in order to open channels with the correct
genesis_blockhash.

Reported-By: @sstone
ppa-0.6.1
Christian Decker 7 years ago
committed by Rusty Russell
parent
commit
fbc2b65a3d
  1. 2
      lightningd/opening/opening.c
  2. 2
      lightningd/opening/opening_wire.csv
  3. 6
      lightningd/peer_control.c

2
lightningd/opening/opening.c

@ -691,6 +691,7 @@ int main(int argc, char *argv[])
u8 channel_flags;
struct utxo *utxos;
u8 *bip32_seed;
u32 network_index;
if (argc == 2 && streq(argv[1], "--version")) {
printf("%s\n", version());
@ -710,6 +711,7 @@ int main(int argc, char *argv[])
status_failed(WIRE_OPENING_BAD_COMMAND, "%s", strerror(errno));
if (!fromwire_opening_init(msg, NULL,
&network_index,
&state->localconf,
&state->max_to_self_delay,
&state->min_effective_htlc_capacity_msat,

2
lightningd/opening/opening_wire.csv

@ -14,6 +14,8 @@ opening_peer_bad_initial_message,0x8014
#include <lightningd/cryptomsg.h>
#include <lightningd/channel_config.h>
opening_init,0
# Which network are we configured for (as index into the chainparams)?
opening_init,,network_index,4
# Base configuration we'll offer (channel reserve will vary with amount)
opening_init,,our_config,struct channel_config
# Minimum/maximum configuration values we'll accept

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

6
lightningd/peer_control.c

@ -1916,7 +1916,8 @@ void peer_fundee_open(struct peer *peer, const u8 *from_peer,
peer->seed = tal(peer, struct privkey);
derive_peer_seed(ld, peer->seed, &peer->id);
msg = towire_opening_init(peer, &peer->our_config,
msg = towire_opening_init(peer, ld->chainparams->index,
&peer->our_config,
max_to_self_delay,
min_effective_htlc_capacity_msat,
cs, peer->seed);
@ -1986,7 +1987,8 @@ static bool gossip_peer_released(struct subd *gossip,
fc->peer->seed = tal(fc->peer, struct privkey);
derive_peer_seed(ld, fc->peer->seed, &fc->peer->id);
msg = towire_opening_init(fc, &fc->peer->our_config,
msg = towire_opening_init(fc, ld->chainparams->index,
&fc->peer->our_config,
max_to_self_delay,
min_effective_htlc_capacity_msat,
&cs, fc->peer->seed);

Loading…
Cancel
Save