opening: Pass network_index through to openingd

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

Reported-By: @sstone
This commit is contained in:
Christian Decker
2017-07-10 13:35:43 +02:00
committed by Rusty Russell
parent 943b6526c7
commit fbc2b65a3d
3 changed files with 8 additions and 2 deletions

View File

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

View File

@@ -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
1 # These shouldn't happen
14 opening_init,0
15 # Base configuration we'll offer (channel reserve will vary with amount) # Which network are we configured for (as index into the chainparams)?
16 opening_init,,our_config,struct channel_config opening_init,,network_index,4
17 # Base configuration we'll offer (channel reserve will vary with amount)
18 opening_init,,our_config,struct channel_config
19 # Minimum/maximum configuration values we'll accept
20 opening_init,,max_to_self_delay,4
21 opening_init,,min_effective_htlc_capacity_msat,8

View File

@@ -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);