|
@ -199,7 +199,6 @@ static u8 *funder_channel(struct state *state, |
|
|
const struct pubkey *our_funding_pubkey, |
|
|
const struct pubkey *our_funding_pubkey, |
|
|
const struct basepoints *ours, |
|
|
const struct basepoints *ours, |
|
|
u32 max_minimum_depth, |
|
|
u32 max_minimum_depth, |
|
|
u16 our_cltv_expiry_delta, |
|
|
|
|
|
u64 change_satoshis, u32 change_keyindex, |
|
|
u64 change_satoshis, u32 change_keyindex, |
|
|
u8 channel_flags, |
|
|
u8 channel_flags, |
|
|
const struct utxo *utxos, |
|
|
const struct utxo *utxos, |
|
@ -212,7 +211,6 @@ static u8 *funder_channel(struct state *state, |
|
|
struct pubkey their_funding_pubkey, changekey; |
|
|
struct pubkey their_funding_pubkey, changekey; |
|
|
secp256k1_ecdsa_signature sig; |
|
|
secp256k1_ecdsa_signature sig; |
|
|
u32 minimum_depth; |
|
|
u32 minimum_depth; |
|
|
u16 their_cltv_expiry_delta; |
|
|
|
|
|
const u8 *wscript; |
|
|
const u8 *wscript; |
|
|
struct bitcoin_tx *funding; |
|
|
struct bitcoin_tx *funding; |
|
|
const struct utxo **utxomap; |
|
|
const struct utxo **utxomap; |
|
@ -251,14 +249,12 @@ static u8 *funder_channel(struct state *state, |
|
|
state->feerate_per_kw, |
|
|
state->feerate_per_kw, |
|
|
state->localconf.to_self_delay, |
|
|
state->localconf.to_self_delay, |
|
|
state->localconf.max_accepted_htlcs, |
|
|
state->localconf.max_accepted_htlcs, |
|
|
our_cltv_expiry_delta, |
|
|
|
|
|
our_funding_pubkey, |
|
|
our_funding_pubkey, |
|
|
&ours->revocation, |
|
|
&ours->revocation, |
|
|
&ours->payment, |
|
|
&ours->payment, |
|
|
&ours->delayed_payment, |
|
|
&ours->delayed_payment, |
|
|
&state->next_per_commit[LOCAL], |
|
|
&state->next_per_commit[LOCAL], |
|
|
channel_flags); |
|
|
channel_flags); |
|
|
|
|
|
|
|
|
if (!sync_crypto_write(&state->cs, PEER_FD, msg)) |
|
|
if (!sync_crypto_write(&state->cs, PEER_FD, msg)) |
|
|
status_failed(STATUS_FAIL_PEER_IO, |
|
|
status_failed(STATUS_FAIL_PEER_IO, |
|
|
"Writing open_channel: %s", strerror(errno)); |
|
|
"Writing open_channel: %s", strerror(errno)); |
|
@ -287,7 +283,6 @@ static u8 *funder_channel(struct state *state, |
|
|
&minimum_depth, |
|
|
&minimum_depth, |
|
|
&state->remoteconf->to_self_delay, |
|
|
&state->remoteconf->to_self_delay, |
|
|
&state->remoteconf->max_accepted_htlcs, |
|
|
&state->remoteconf->max_accepted_htlcs, |
|
|
&their_cltv_expiry_delta, |
|
|
|
|
|
&their_funding_pubkey, |
|
|
&their_funding_pubkey, |
|
|
&theirs.revocation, |
|
|
&theirs.revocation, |
|
|
&theirs.payment, |
|
|
&theirs.payment, |
|
@ -450,8 +445,7 @@ static u8 *funder_channel(struct state *state, |
|
|
minimum_depth, |
|
|
minimum_depth, |
|
|
&their_funding_pubkey, |
|
|
&their_funding_pubkey, |
|
|
&state->funding_txid, |
|
|
&state->funding_txid, |
|
|
state->feerate_per_kw, |
|
|
state->feerate_per_kw); |
|
|
their_cltv_expiry_delta); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* This is handed the message the peer sent which caused gossip to stop:
|
|
|
/* This is handed the message the peer sent which caused gossip to stop:
|
|
@ -460,7 +454,6 @@ static u8 *fundee_channel(struct state *state, |
|
|
const struct pubkey *our_funding_pubkey, |
|
|
const struct pubkey *our_funding_pubkey, |
|
|
const struct basepoints *ours, |
|
|
const struct basepoints *ours, |
|
|
u32 minimum_depth, |
|
|
u32 minimum_depth, |
|
|
u16 our_cltv_expiry_delta, |
|
|
|
|
|
u32 min_feerate, u32 max_feerate, const u8 *peer_msg) |
|
|
u32 min_feerate, u32 max_feerate, const u8 *peer_msg) |
|
|
{ |
|
|
{ |
|
|
struct channel_id id_in; |
|
|
struct channel_id id_in; |
|
@ -472,7 +465,6 @@ static u8 *fundee_channel(struct state *state, |
|
|
u8 *msg; |
|
|
u8 *msg; |
|
|
const u8 *wscript; |
|
|
const u8 *wscript; |
|
|
u8 channel_flags; |
|
|
u8 channel_flags; |
|
|
u16 their_cltv_expiry_delta; |
|
|
|
|
|
|
|
|
|
|
|
state->remoteconf = tal(state, struct channel_config); |
|
|
state->remoteconf = tal(state, struct channel_config); |
|
|
|
|
|
|
|
@ -493,7 +485,6 @@ static u8 *fundee_channel(struct state *state, |
|
|
&state->feerate_per_kw, |
|
|
&state->feerate_per_kw, |
|
|
&state->remoteconf->to_self_delay, |
|
|
&state->remoteconf->to_self_delay, |
|
|
&state->remoteconf->max_accepted_htlcs, |
|
|
&state->remoteconf->max_accepted_htlcs, |
|
|
&their_cltv_expiry_delta, |
|
|
|
|
|
&their_funding_pubkey, |
|
|
&their_funding_pubkey, |
|
|
&theirs.revocation, |
|
|
&theirs.revocation, |
|
|
&theirs.payment, |
|
|
&theirs.payment, |
|
@ -565,7 +556,6 @@ static u8 *fundee_channel(struct state *state, |
|
|
minimum_depth, |
|
|
minimum_depth, |
|
|
state->localconf.to_self_delay, |
|
|
state->localconf.to_self_delay, |
|
|
state->localconf.max_accepted_htlcs, |
|
|
state->localconf.max_accepted_htlcs, |
|
|
our_cltv_expiry_delta, |
|
|
|
|
|
our_funding_pubkey, |
|
|
our_funding_pubkey, |
|
|
&ours->revocation, |
|
|
&ours->revocation, |
|
|
&ours->payment, |
|
|
&ours->payment, |
|
@ -678,8 +668,7 @@ static u8 *fundee_channel(struct state *state, |
|
|
state->push_msat, |
|
|
state->push_msat, |
|
|
channel_flags, |
|
|
channel_flags, |
|
|
state->feerate_per_kw, |
|
|
state->feerate_per_kw, |
|
|
msg, |
|
|
msg); |
|
|
their_cltv_expiry_delta); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifndef TESTING |
|
|
#ifndef TESTING |
|
@ -698,7 +687,6 @@ int main(int argc, char *argv[]) |
|
|
struct utxo *utxos; |
|
|
struct utxo *utxos; |
|
|
struct ext_key bip32_base; |
|
|
struct ext_key bip32_base; |
|
|
u32 network_index; |
|
|
u32 network_index; |
|
|
u16 our_cltv_expiry_delta; |
|
|
|
|
|
|
|
|
|
|
|
if (argc == 2 && streq(argv[1], "--version")) { |
|
|
if (argc == 2 && streq(argv[1], "--version")) { |
|
|
printf("%s\n", version()); |
|
|
printf("%s\n", version()); |
|
@ -720,8 +708,7 @@ int main(int argc, char *argv[]) |
|
|
&state->max_to_self_delay, |
|
|
&state->max_to_self_delay, |
|
|
&state->min_effective_htlc_capacity_msat, |
|
|
&state->min_effective_htlc_capacity_msat, |
|
|
&state->cs, |
|
|
&state->cs, |
|
|
&seed, |
|
|
&seed)) |
|
|
&our_cltv_expiry_delta)) |
|
|
|
|
|
master_badmsg(WIRE_OPENING_INIT, msg); |
|
|
master_badmsg(WIRE_OPENING_INIT, msg); |
|
|
|
|
|
|
|
|
tal_free(msg); |
|
|
tal_free(msg); |
|
@ -754,16 +741,14 @@ int main(int argc, char *argv[]) |
|
|
&change_satoshis, &change_keyindex, |
|
|
&change_satoshis, &change_keyindex, |
|
|
&channel_flags, &utxos, &bip32_base)) |
|
|
&channel_flags, &utxos, &bip32_base)) |
|
|
msg = funder_channel(state, &our_funding_pubkey, &our_points, |
|
|
msg = funder_channel(state, &our_funding_pubkey, &our_points, |
|
|
max_minimum_depth, our_cltv_expiry_delta, |
|
|
max_minimum_depth, change_satoshis, |
|
|
change_satoshis, change_keyindex, |
|
|
change_keyindex, channel_flags, |
|
|
channel_flags, |
|
|
|
|
|
utxos, &bip32_base); |
|
|
utxos, &bip32_base); |
|
|
else if (fromwire_opening_fundee(state, msg, NULL, &minimum_depth, |
|
|
else if (fromwire_opening_fundee(state, msg, NULL, &minimum_depth, |
|
|
&min_feerate, &max_feerate, &peer_msg)) |
|
|
&min_feerate, &max_feerate, &peer_msg)) |
|
|
msg = fundee_channel(state, &our_funding_pubkey, &our_points, |
|
|
msg = fundee_channel(state, &our_funding_pubkey, &our_points, |
|
|
minimum_depth, our_cltv_expiry_delta, |
|
|
minimum_depth, min_feerate, max_feerate, |
|
|
min_feerate, max_feerate, |
|
|
peer_msg); |
|
|
peer_msg); |
|
|
|
|
|
else |
|
|
else |
|
|
status_failed(STATUS_FAIL_MASTER_IO, |
|
|
status_failed(STATUS_FAIL_MASTER_IO, |
|
|
"neither funder nor fundee: %s", |
|
|
"neither funder nor fundee: %s", |
|
|