diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 5155129ea..8da97f282 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -2813,8 +2813,7 @@ AUTODATA(json_command, &openchannel_abort_command); static void start_fresh_dualopend(struct peer *peer, struct per_peer_state *pps, - struct channel *channel, - const u8 *send_msg) + struct channel *channel) { int hsmfd; u32 max_to_self_delay; @@ -2867,16 +2866,14 @@ static void start_fresh_dualopend(struct peer *peer, min_effective_htlc_capacity, pps, &channel->local_basepoints, &channel->local_funding_pubkey, - channel->minimum_depth, - send_msg); + channel->minimum_depth); subd_send_msg(channel->owner, take(msg)); } void peer_restart_dualopend(struct peer *peer, struct per_peer_state *pps, - struct channel *channel, - const u8 *send_msg) + struct channel *channel) { u32 max_to_self_delay; struct amount_msat min_effective_htlc_capacity; @@ -2886,7 +2883,7 @@ void peer_restart_dualopend(struct peer *peer, u8 *msg; if (channel_unsaved(channel)) { - start_fresh_dualopend(peer, pps, channel, send_msg); + start_fresh_dualopend(peer, pps, channel); return; } hsmfd = hsm_get_client_fd(peer->ld, &peer->id, channel->dbid, @@ -2960,16 +2957,13 @@ void peer_restart_dualopend(struct peer *peer, channel->remote_upfront_shutdown_script, inflight->remote_tx_sigs, channel->fee_states, - channel->channel_flags, - send_msg); + channel->channel_flags); subd_send_msg(channel->owner, take(msg)); } -void peer_start_dualopend(struct peer *peer, - struct per_peer_state *pps, - const u8 *send_msg) +void peer_start_dualopend(struct peer *peer, struct per_peer_state *pps) { struct channel *channel; @@ -2979,5 +2973,5 @@ void peer_start_dualopend(struct peer *peer, peer->ld->config.fee_base, peer->ld->config.fee_per_satoshi); - start_fresh_dualopend(peer, pps, channel, send_msg); + start_fresh_dualopend(peer, pps, channel); } diff --git a/lightningd/dual_open_control.h b/lightningd/dual_open_control.h index 4166d3ec6..8657a40a6 100644 --- a/lightningd/dual_open_control.h +++ b/lightningd/dual_open_control.h @@ -6,14 +6,11 @@ struct per_peer_state; -void peer_start_dualopend(struct peer *peer, - struct per_peer_state *pps, - const u8 *send_msg); +void peer_start_dualopend(struct peer *peer, struct per_peer_state *pps); void peer_restart_dualopend(struct peer *peer, struct per_peer_state *pps, - struct channel *channel, - const u8 *send_msg); + struct channel *channel); void dualopen_tell_depth(struct subd *dualopend, struct channel *channel, diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index df6336c1f..684c472b1 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -876,9 +876,7 @@ static unsigned int openingd_msg(struct subd *openingd, return 0; } -void peer_start_openingd(struct peer *peer, - struct per_peer_state *pps, - const u8 *send_msg) +void peer_start_openingd(struct peer *peer, struct per_peer_state *pps) { int hsmfd; u32 max_to_self_delay; @@ -944,7 +942,6 @@ void peer_start_openingd(struct peer *peer, feature_negotiated(peer->ld->our_features, peer->their_features, OPT_ANCHOR_OUTPUTS), - send_msg, IFDEV(peer->ld->dev_force_tmp_channel_id, NULL), IFDEV(peer->ld->dev_fast_gossip, false)); subd_send_msg(uc->open_daemon, take(msg)); diff --git a/lightningd/opening_control.h b/lightningd/opening_control.h index d3f0d7257..3c5f3343a 100644 --- a/lightningd/opening_control.h +++ b/lightningd/opening_control.h @@ -15,8 +15,7 @@ void json_add_uncommitted_channel(struct json_stream *response, const struct uncommitted_channel *uc); void peer_start_openingd(struct peer *peer, - struct per_peer_state *pps, - const u8 *msg); + struct per_peer_state *pps); struct subd *peer_get_owning_subd(struct peer *peer); diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index e9cea141b..812e3f121 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1113,7 +1113,7 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa assert(!channel->owner); channel->peer->addr = addr; channel->peer->connected_incoming = payload->incoming; - peer_restart_dualopend(peer, payload->pps, channel, NULL); + peer_restart_dualopend(peer, payload->pps, channel); return; case CHANNELD_AWAITING_LOCKIN: case CHANNELD_NORMAL: @@ -1146,11 +1146,11 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa || channel->state == AWAITING_UNILATERAL); channel->peer->addr = addr; channel->peer->connected_incoming = payload->incoming; - peer_restart_dualopend(peer, payload->pps, channel, NULL); + peer_restart_dualopend(peer, payload->pps, channel); } else - peer_start_dualopend(peer, payload->pps, NULL); + peer_start_dualopend(peer, payload->pps); } else - peer_start_openingd(peer, payload->pps, NULL); + peer_start_openingd(peer, payload->pps); return; send_error: diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c index c3683f6df..8709fb588 100644 --- a/lightningd/test/run-invoice-select-inchan.c +++ b/lightningd/test/run-invoice-select-inchan.c @@ -569,8 +569,7 @@ struct channel *peer_normal_channel(struct peer *peer UNNEEDED) /* Generated stub for peer_restart_dualopend */ void peer_restart_dualopend(struct peer *peer UNNEEDED, struct per_peer_state *pps UNNEEDED, - struct channel *channel UNNEEDED, - const u8 *send_msg UNNEEDED) + struct channel *channel UNNEEDED) { fprintf(stderr, "peer_restart_dualopend called!\n"); abort(); } /* Generated stub for peer_start_channeld */ void peer_start_channeld(struct channel *channel UNNEEDED, @@ -585,14 +584,11 @@ void peer_start_closingd(struct channel *channel UNNEEDED, const u8 *channel_reestablish UNNEEDED) { fprintf(stderr, "peer_start_closingd called!\n"); abort(); } /* Generated stub for peer_start_dualopend */ -void peer_start_dualopend(struct peer *peer UNNEEDED, - struct per_peer_state *pps UNNEEDED, - const u8 *send_msg UNNEEDED) +void peer_start_dualopend(struct peer *peer UNNEEDED, struct per_peer_state *pps UNNEEDED) { fprintf(stderr, "peer_start_dualopend called!\n"); abort(); } /* Generated stub for peer_start_openingd */ void peer_start_openingd(struct peer *peer UNNEEDED, - struct per_peer_state *pps UNNEEDED, - const u8 *msg UNNEEDED) + struct per_peer_state *pps UNNEEDED) { fprintf(stderr, "peer_start_openingd called!\n"); abort(); } /* Generated stub for peer_unsaved_channel */ struct channel *peer_unsaved_channel(struct peer *peer UNNEEDED) diff --git a/openingd/dualopend.c b/openingd/dualopend.c index a264bbf20..5ebae60b2 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -3251,24 +3251,6 @@ static void do_reconnect_dance(struct state *state) peer_billboard(true, "Reconnected, and reestablished."); } -/*~ Is this message of type `error` with the special zero-id - * "fail-everything"? If lightningd asked us to send such a thing, we're - * done. */ -static void fail_if_all_error(const u8 *inner) -{ - struct channel_id channel_id; - u8 *data; - - if (!fromwire_error(tmpctx, inner, &channel_id, &data) - || !channel_id_is_all(&channel_id)) { - return; - } - - status_info("Master said send err: %s", - sanitize_error(tmpctx, inner, NULL)); - exit(0); -} - /* Standard lightningd-fd-is-ready-to-read demux code. Again, we could hang * here, but if we can't trust our parent, who can we trust? */ static u8 *handle_master_in(struct state *state) @@ -3456,7 +3438,7 @@ int main(int argc, char *argv[]) struct secret *none; struct fee_states *fee_states; enum side opener; - u8 *msg, *inner; + u8 *msg; struct amount_sat total_funding; struct amount_msat our_msat; @@ -3481,8 +3463,7 @@ int main(int argc, char *argv[]) &state->pps, &state->our_points, &state->our_funding_pubkey, - &state->minimum_depth, - &inner)) { + &state->minimum_depth)) { /*~ Initially we're not associated with a channel, but * handle_peer_gossip_or_error compares this. */ memset(&state->channel_id, 0, sizeof(state->channel_id)); @@ -3534,8 +3515,7 @@ int main(int argc, char *argv[]) &state->upfront_shutdown_script[REMOTE], &state->tx_state->remote_funding_sigs_rcvd, &fee_states, - &state->channel_flags, - &inner)) { + &state->channel_flags)) { /*~ We only reconnect on channels that the * saved the the database (exchanged commitment sigs) */ @@ -3571,14 +3551,6 @@ int main(int argc, char *argv[]) /* 3 == peer, 4 == gossipd, 5 = gossip_store, 6 = hsmd */ per_peer_state_set_fds(state->pps, 3, 4, 5); - /*~ If lightningd wanted us to send a msg, do so before we waste time - * doing work. If it's a global error, we'll close immediately. */ - if (inner != NULL) { - sync_crypto_write(state->pps, inner); - fail_if_all_error(inner); - tal_free(inner); - } - /*~ We need an initial per-commitment point whether we're funding or * they are, and lightningd has reserved a unique dbid for us already, * so we might as well get the hsm daemon to generate it now. */ diff --git a/openingd/dualopend_wire.csv b/openingd/dualopend_wire.csv index 0608f57f6..217f935aa 100644 --- a/openingd/dualopend_wire.csv +++ b/openingd/dualopend_wire.csv @@ -26,9 +26,6 @@ msgdata,dualopend_init,our_basepoints,basepoints, msgdata,dualopend_init,our_funding_pubkey,pubkey, # Constraints in case the other end tries to open a channel. msgdata,dualopend_init,minimum_depth,u32, -# Optional msg to send. -msgdata,dualopend_init,len,u16, -msgdata,dualopend_init,msg,u8,len # master-dualopend: peer has reconnected msgtype,dualopend_reinit,7001 @@ -67,9 +64,6 @@ msgdata,dualopend_reinit,remote_shutdown_scriptpubkey,u8,remote_shutdown_len msgdata,dualopend_reinit,remote_funding_sigs_received,bool, msgdata,dualopend_reinit,fee_states,fee_states, msgdata,dualopend_reinit,channel_flags,u8, -# Optional msg to send. -msgdata,dualopend_reinit,len,u16, -msgdata,dualopend_reinit,msg,u8,len # dualopend->master: they offered channel, should we continue? msgtype,dualopend_got_offer,7005 diff --git a/openingd/dualopend_wiregen.c b/openingd/dualopend_wiregen.c index e354eca37..21ace02e4 100644 --- a/openingd/dualopend_wiregen.c +++ b/openingd/dualopend_wiregen.c @@ -91,10 +91,9 @@ bool dualopend_wire_is_defined(u16 type) /* WIRE: DUALOPEND_INIT */ -u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, const u8 *msg) +u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth) { u16 their_init_features_len = tal_count(their_init_features); - u16 len = tal_count(msg); u8 *p = tal_arr(ctx, u8, 0); towire_u16(&p, WIRE_DUALOPEND_INIT); @@ -113,16 +112,12 @@ u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparam towire_pubkey(&p, our_funding_pubkey); /* Constraints in case the other end tries to open a channel. */ towire_u32(&p, minimum_depth); - /* Optional msg to send. */ - towire_u16(&p, len); - towire_u8_array(&p, msg, len); return memcheck(p, tal_count(p)); } -bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u8 **msg) +bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth) { u16 their_init_features_len; - u16 len; const u8 *cursor = p; size_t plen = tal_count(p); @@ -146,22 +141,16 @@ bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chain fromwire_pubkey(&cursor, &plen, our_funding_pubkey); /* Constraints in case the other end tries to open a channel. */ *minimum_depth = fromwire_u32(&cursor, &plen); - /* Optional msg to send. */ - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); return cursor != NULL; } /* WIRE: DUALOPEND_REINIT */ /* master-dualopend: peer has reconnected */ -u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 orignal_feerate_per_kw_funding, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags, const u8 *msg) +u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 orignal_feerate_per_kw_funding, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags) { u16 their_init_features_len = tal_count(their_init_features); u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey); u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey); - u16 len = tal_count(msg); u8 *p = tal_arr(ctx, u8, 0); towire_u16(&p, WIRE_DUALOPEND_REINIT); @@ -200,18 +189,14 @@ u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainpar towire_bool(&p, remote_funding_sigs_received); towire_fee_states(&p, fee_states); towire_u8(&p, channel_flags); - /* Optional msg to send. */ - towire_u16(&p, len); - towire_u8_array(&p, msg, len); return memcheck(p, tal_count(p)); } -bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *orignal_feerate_per_kw_funding, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags, u8 **msg) +bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *orignal_feerate_per_kw_funding, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags) { u16 their_init_features_len; u16 local_shutdown_len; u16 remote_shutdown_len; - u16 len; const u8 *cursor = p; size_t plen = tal_count(p); @@ -259,11 +244,6 @@ bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct cha *remote_funding_sigs_received = fromwire_bool(&cursor, &plen); *fee_states = fromwire_fee_states(ctx, &cursor, &plen); *channel_flags = fromwire_u8(&cursor, &plen); - /* Optional msg to send. */ - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); return cursor != NULL; } @@ -932,4 +912,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:b93c5d3aad8cc2f256ed1205341ff68ea34d5bfc4a0d05071a8fe28177186bc5 +// SHA256STAMP:0cbaf66a07e1ffa2e01a85398b6937391af66eb78302e22fe7b9a3076963db4e diff --git a/openingd/dualopend_wiregen.h b/openingd/dualopend_wiregen.h index f1de1c45f..ac4c0597a 100644 --- a/openingd/dualopend_wiregen.h +++ b/openingd/dualopend_wiregen.h @@ -86,13 +86,13 @@ bool dualopend_wire_is_defined(u16 type); /* WIRE: DUALOPEND_INIT */ -u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, const u8 *msg); -bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u8 **msg); +u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth); +bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth); /* WIRE: DUALOPEND_REINIT */ /* master-dualopend: peer has reconnected */ -u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 orignal_feerate_per_kw_funding, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags, const u8 *msg); -bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *orignal_feerate_per_kw_funding, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags, u8 **msg); +u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 orignal_feerate_per_kw_funding, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags); +bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *orignal_feerate_per_kw_funding, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags); /* WIRE: DUALOPEND_GOT_OFFER */ /* dualopend->master: they offered channel */ @@ -216,4 +216,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */ -// SHA256STAMP:b93c5d3aad8cc2f256ed1205341ff68ea34d5bfc4a0d05071a8fe28177186bc5 +// SHA256STAMP:0cbaf66a07e1ffa2e01a85398b6937391af66eb78302e22fe7b9a3076963db4e diff --git a/openingd/openingd.c b/openingd/openingd.c index 1e55e834e..7a0d1bdee 100644 --- a/openingd/openingd.c +++ b/openingd/openingd.c @@ -1197,22 +1197,6 @@ static void handle_gossip_in(struct state *state) handle_gossip_msg(state->pps, take(msg)); } -/*~ Is this message of a `warning` or `error`? If lightningd asked us to send - * such a thing, it wants to close the connection. */ -static void fail_if_warning_or_error(const u8 *inner) -{ - struct channel_id channel_id; - u8 *data; - - if (!fromwire_warning(tmpctx, inner, &channel_id, &data) - && !fromwire_error(tmpctx, inner, &channel_id, &data)) - return; - - status_info("Master said send %s", - sanitize_error(tmpctx, inner, NULL)); - exit(0); -} - /* Memory leak detection is DEVELOPER-only because we go to great lengths to * record the backtrace when allocations occur: without that, the leak * detection tends to be useless for diagnosing where the leak came from, but @@ -1336,7 +1320,7 @@ int main(int argc, char *argv[]) { setup_locale(); - u8 *msg, *inner; + u8 *msg; struct pollfd pollfd[3]; struct state *state = tal(NULL, struct state); struct secret *none; @@ -1364,7 +1348,6 @@ int main(int argc, char *argv[]) &state->their_features, &state->option_static_remotekey, &state->option_anchor_outputs, - &inner, &force_tmp_channel_id, &dev_fast_gossip)) master_badmsg(WIRE_OPENINGD_INIT, msg); @@ -1376,14 +1359,6 @@ int main(int argc, char *argv[]) /* 3 == peer, 4 == gossipd, 5 = gossip_store, 6 = hsmd */ per_peer_state_set_fds(state->pps, 3, 4, 5); - /*~ If lightningd wanted us to send a msg, do so before we waste time - * doing work. If it's a warning, we'll close immediately. */ - if (inner != NULL) { - sync_crypto_write(state->pps, inner); - fail_if_warning_or_error(inner); - tal_free(inner); - } - /*~ Initially we're not associated with a channel, but * handle_peer_gossip_or_error compares this. */ memset(&state->channel_id, 0, sizeof(state->channel_id)); diff --git a/openingd/openingd_wire.csv b/openingd/openingd_wire.csv index db52cdc60..0c4e6ff80 100644 --- a/openingd/openingd_wire.csv +++ b/openingd/openingd_wire.csv @@ -26,9 +26,6 @@ msgdata,openingd_init,lfeatures_len,u16, msgdata,openingd_init,lfeatures,u8,lfeatures_len msgdata,openingd_init,option_static_remotekey,bool, msgdata,openingd_init,option_anchor_outputs,bool, -# Optional msg to send. -msgdata,openingd_init,len,u16, -msgdata,openingd_init,msg,u8,len msgdata,openingd_init,dev_temporary_channel_id,?byte,32 msgdata,openingd_init,dev_fast_gossip,bool, diff --git a/openingd/openingd_wiregen.c b/openingd/openingd_wiregen.c index 8ac045def..28442fda3 100644 --- a/openingd/openingd_wiregen.c +++ b/openingd/openingd_wiregen.c @@ -63,10 +63,9 @@ bool openingd_wire_is_defined(u16 type) /* WIRE: OPENINGD_INIT */ -u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, u32 min_feerate, u32 max_feerate, const u8 *lfeatures, bool option_static_remotekey, bool option_anchor_outputs, const u8 *msg, const struct channel_id *dev_temporary_channel_id, bool dev_fast_gossip) +u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, u32 min_feerate, u32 max_feerate, const u8 *lfeatures, bool option_static_remotekey, bool option_anchor_outputs, const struct channel_id *dev_temporary_channel_id, bool dev_fast_gossip) { u16 lfeatures_len = tal_count(lfeatures); - u16 len = tal_count(msg); u8 *p = tal_arr(ctx, u8, 0); towire_u16(&p, WIRE_OPENINGD_INIT); @@ -89,9 +88,6 @@ u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams towire_u8_array(&p, lfeatures, lfeatures_len); towire_bool(&p, option_static_remotekey); towire_bool(&p, option_anchor_outputs); - /* Optional msg to send. */ - towire_u16(&p, len); - towire_u8_array(&p, msg, len); if (!dev_temporary_channel_id) towire_bool(&p, false); else { @@ -102,10 +98,9 @@ u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams return memcheck(p, tal_count(p)); } -bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u32 *min_feerate, u32 *max_feerate, u8 **lfeatures, bool *option_static_remotekey, bool *option_anchor_outputs, u8 **msg, struct channel_id **dev_temporary_channel_id, bool *dev_fast_gossip) +bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u32 *min_feerate, u32 *max_feerate, u8 **lfeatures, bool *option_static_remotekey, bool *option_anchor_outputs, struct channel_id **dev_temporary_channel_id, bool *dev_fast_gossip) { u16 lfeatures_len; - u16 len; const u8 *cursor = p; size_t plen = tal_count(p); @@ -133,11 +128,6 @@ bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainp fromwire_u8_array(&cursor, &plen, *lfeatures, lfeatures_len); *option_static_remotekey = fromwire_bool(&cursor, &plen); *option_anchor_outputs = fromwire_bool(&cursor, &plen); - /* Optional msg to send. */ - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); if (!fromwire_bool(&cursor, &plen)) *dev_temporary_channel_id = NULL; else { @@ -579,4 +569,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:056c30b94922859252e3b4171c02c1986242c0ec1f71f78ea62c3a0b5d26a696 +// SHA256STAMP:edd7ee392dff0ddd0dff3a383692ba852a403e64e43290dba5dece69ae438e61 diff --git a/openingd/openingd_wiregen.h b/openingd/openingd_wiregen.h index 9fdf7f45e..ba64e5567 100644 --- a/openingd/openingd_wiregen.h +++ b/openingd/openingd_wiregen.h @@ -58,8 +58,8 @@ bool openingd_wire_is_defined(u16 type); /* WIRE: OPENINGD_INIT */ -u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, u32 min_feerate, u32 max_feerate, const u8 *lfeatures, bool option_static_remotekey, bool option_anchor_outputs, const u8 *msg, const struct channel_id *dev_temporary_channel_id, bool dev_fast_gossip); -bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u32 *min_feerate, u32 *max_feerate, u8 **lfeatures, bool *option_static_remotekey, bool *option_anchor_outputs, u8 **msg, struct channel_id **dev_temporary_channel_id, bool *dev_fast_gossip); +u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, u32 min_feerate, u32 max_feerate, const u8 *lfeatures, bool option_static_remotekey, bool option_anchor_outputs, const struct channel_id *dev_temporary_channel_id, bool dev_fast_gossip); +bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u32 *min_feerate, u32 *max_feerate, u8 **lfeatures, bool *option_static_remotekey, bool *option_anchor_outputs, struct channel_id **dev_temporary_channel_id, bool *dev_fast_gossip); /* WIRE: OPENINGD_GOT_OFFER */ /* Openingd->master: they offered channel */ @@ -121,4 +121,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H */ -// SHA256STAMP:056c30b94922859252e3b4171c02c1986242c0ec1f71f78ea62c3a0b5d26a696 +// SHA256STAMP:edd7ee392dff0ddd0dff3a383692ba852a403e64e43290dba5dece69ae438e61 diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index 87548771d..1e4899c67 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -1906,4 +1906,4 @@ struct db_query db_postgres_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ -// SHA256STAMP:c9d9d585e1fcba900b06f41123aa77c6fbd98945ffe485528c2601323f340bed +// SHA256STAMP:2839b3ea02654d43cce04742850e4c42541818c1641ab5119f077d859a288e5a diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 0dfbe477b..79582f04f 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -1906,4 +1906,4 @@ struct db_query db_sqlite3_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:c9d9d585e1fcba900b06f41123aa77c6fbd98945ffe485528c2601323f340bed +// SHA256STAMP:2839b3ea02654d43cce04742850e4c42541818c1641ab5119f077d859a288e5a diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index f0ce58886..f41b5e86a 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -1250,11 +1250,11 @@ msgstr "" msgid "not a valid SQL statement" msgstr "" -#: wallet/test/run-wallet.c:1455 +#: wallet/test/run-wallet.c:1451 msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;" msgstr "" -#: wallet/test/run-wallet.c:1653 +#: wallet/test/run-wallet.c:1649 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:ef55222dd765f18ae8d8f000c51b6024bbe7acafc17dd0b6837a180d7b736270 +# SHA256STAMP:61244f420c5eefe9cf60f0599cdd6c17d38f719ed2bc5acac93ee1109f121dcf diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index 1043a2a2a..e93ebe418 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -641,8 +641,7 @@ void peer_memleak_done(struct command *cmd UNNEEDED, struct subd *leaker UNNEEDE /* Generated stub for peer_restart_dualopend */ void peer_restart_dualopend(struct peer *peer UNNEEDED, struct per_peer_state *pps UNNEEDED, - struct channel *channel UNNEEDED, - const u8 *send_msg UNNEEDED) + struct channel *channel UNNEEDED) { fprintf(stderr, "peer_restart_dualopend called!\n"); abort(); } /* Generated stub for peer_start_channeld */ void peer_start_channeld(struct channel *channel UNNEEDED, @@ -657,14 +656,11 @@ void peer_start_closingd(struct channel *channel UNNEEDED, const u8 *channel_reestablish UNNEEDED) { fprintf(stderr, "peer_start_closingd called!\n"); abort(); } /* Generated stub for peer_start_dualopend */ -void peer_start_dualopend(struct peer *peer UNNEEDED, - struct per_peer_state *pps UNNEEDED, - const u8 *send_msg UNNEEDED) +void peer_start_dualopend(struct peer *peer UNNEEDED, struct per_peer_state *pps UNNEEDED) { fprintf(stderr, "peer_start_dualopend called!\n"); abort(); } /* Generated stub for peer_start_openingd */ void peer_start_openingd(struct peer *peer UNNEEDED, - struct per_peer_state *pps UNNEEDED, - const u8 *msg UNNEEDED) + struct per_peer_state *pps UNNEEDED) { fprintf(stderr, "peer_start_openingd called!\n"); abort(); } /* Generated stub for peer_wire_is_defined */ bool peer_wire_is_defined(u16 type UNNEEDED)