diff --git a/closingd/closingd.c b/closingd/closingd.c index 1184b12a7..6c95ab926 100644 --- a/closingd/closingd.c +++ b/closingd/closingd.c @@ -130,158 +130,6 @@ static u8 *closing_read_peer_msg(const tal_t *ctx, } } -static struct pubkey get_per_commitment_point(u64 commitment_number) -{ - u8 *msg; - struct pubkey commitment_point; - struct secret *s; - - /* Our current per-commitment point is the commitment point in the last - * received signed commitment; HSM gives us that and the previous - * secret (which we don't need). */ - msg = towire_hsmd_get_per_commitment_point(NULL, - commitment_number); - if (!wire_sync_write(HSM_FD, take(msg))) - status_failed(STATUS_FAIL_HSM_IO, - "Writing get_per_commitment_point to HSM: %s", - strerror(errno)); - - msg = wire_sync_read(tmpctx, HSM_FD); - if (!msg) - status_failed(STATUS_FAIL_HSM_IO, - "Reading resp get_per_commitment_point reply: %s", - strerror(errno)); - if (!fromwire_hsmd_get_per_commitment_point_reply(tmpctx, msg, - &commitment_point, - &s)) - status_failed(STATUS_FAIL_HSM_IO, - "Bad per_commitment_point reply %s", - tal_hex(tmpctx, msg)); - - return commitment_point; -} - -static void do_reconnect(struct per_peer_state *pps, - const struct channel_id *channel_id, - const u64 next_index[NUM_SIDES], - u64 revocations_received, - const u8 *channel_reestablish, - const u8 *final_scriptpubkey, - const struct secret *last_remote_per_commit_secret, - const struct bitcoin_outpoint *wrong_funding) -{ - u8 *msg; - struct channel_id their_channel_id; - u64 next_local_commitment_number, next_remote_revocation_number; - struct pubkey my_current_per_commitment_point, next_commitment_point; - struct secret their_secret; - struct tlv_shutdown_tlvs *tlvs; -#if EXPERIMENTAL_FEATURES - struct tlv_channel_reestablish_tlvs *reestablish_tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); -#endif - - my_current_per_commitment_point = get_per_commitment_point(next_index[LOCAL]-1); - - /* BOLT #2: - * - * - upon reconnection: - * - if a channel is in an error state: - * - SHOULD retransmit the error packet and ignore any other packets for - * that channel. - * - otherwise: - * - MUST transmit `channel_reestablish` for each channel. - * - MUST wait to receive the other node's `channel_reestablish` - * message before sending any other messages for that channel. - * - * The sending node: - * - MUST set `next_commitment_number` to the commitment number - * of the next `commitment_signed` it expects to receive. - * - MUST set `next_revocation_number` to the commitment number - * of the next `revoke_and_ack` message it expects to receive. - */ - - msg = towire_channel_reestablish(NULL, channel_id, - next_index[LOCAL], - revocations_received, - last_remote_per_commit_secret, - &my_current_per_commitment_point -#if EXPERIMENTAL_FEATURES - , reestablish_tlvs -#endif - ); - sync_crypto_write(pps, take(msg)); - - /* They might have already sent reestablish, which triggered us */ - if (!channel_reestablish) { - do { - tal_free(channel_reestablish); - channel_reestablish = closing_read_peer_msg(tmpctx, pps, - channel_id); - /* They *should* send reestablish first, but lnd - * sends other messages, which we can ignore since - * we're closing anyway... */ - } while (fromwire_peektype(channel_reestablish) - != WIRE_CHANNEL_REESTABLISH); - } - -#if EXPERIMENTAL_FEATURES - reestablish_tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); -#endif - - if (!fromwire_channel_reestablish(channel_reestablish, &their_channel_id, - &next_local_commitment_number, - &next_remote_revocation_number, - &their_secret, - &next_commitment_point -#if EXPERIMENTAL_FEATURES - , reestablish_tlvs -#endif - )) { - peer_failed_warn(pps, channel_id, - "bad reestablish msg: %s %s", - peer_wire_name(fromwire_peektype(channel_reestablish)), - tal_hex(tmpctx, channel_reestablish)); - } - status_debug("Got reestablish commit=%"PRIu64" revoke=%"PRIu64, - next_local_commitment_number, - next_remote_revocation_number); - - /* BOLT #2: - * - * A node: - *... - * - upon reconnection: - * - if it has sent a previous `shutdown`: - * - MUST retransmit `shutdown`. - */ - if (wrong_funding) { - tlvs = tlv_shutdown_tlvs_new(tmpctx); - tlvs->wrong_funding - = tal(tlvs, struct tlv_shutdown_tlvs_wrong_funding); - tlvs->wrong_funding->txid = wrong_funding->txid; - tlvs->wrong_funding->outnum = wrong_funding->n; - } else - tlvs = NULL; - - msg = towire_shutdown(NULL, channel_id, final_scriptpubkey, tlvs); - sync_crypto_write(pps, take(msg)); - - /* BOLT #2: - * - * A node: - *... - * - if `next_commitment_number` is 1 in both the `channel_reestablish` it sent and received: - * - MUST retransmit `funding_locked`. - */ - if (next_index[REMOTE] == 1 && next_index[LOCAL] == 1) { - status_debug("Retransmitting funding_locked for channel %s", - type_to_string(tmpctx, struct channel_id, channel_id)); - next_commitment_point = get_per_commitment_point(next_index[LOCAL]); - msg = towire_funding_locked(NULL, channel_id, &next_commitment_point); - sync_crypto_write(pps, take(msg)); - } -} - static void send_offer(struct per_peer_state *pps, const struct chainparams *chainparams, const struct channel_id *channel_id, @@ -663,11 +511,7 @@ int main(int argc, char *argv[]) u8 fee_negotiation_step_unit; char fee_negotiation_step_str[32]; /* fee_negotiation_step + "sat" */ struct channel_id channel_id; - bool reconnected; - u64 next_index[NUM_SIDES], revocations_received; enum side whose_turn; - u8 *channel_reestablish; - struct secret last_remote_per_commit_secret; struct bitcoin_outpoint *wrong_funding; subdaemon_setup(argc, argv); @@ -693,12 +537,6 @@ int main(int argc, char *argv[]) &scriptpubkey[REMOTE], &fee_negotiation_step, &fee_negotiation_step_unit, - &reconnected, - &next_index[LOCAL], - &next_index[REMOTE], - &revocations_received, - &channel_reestablish, - &last_remote_per_commit_secret, &dev_fast_gossip, &wrong_funding)) master_badmsg(WIRE_CLOSINGD_INIT, msg); @@ -731,13 +569,6 @@ int main(int argc, char *argv[]) &funding_pubkey[LOCAL], &funding_pubkey[REMOTE]); - if (reconnected) - do_reconnect(pps, &channel_id, - next_index, revocations_received, - channel_reestablish, scriptpubkey[LOCAL], - &last_remote_per_commit_secret, - wrong_funding); - peer_billboard( true, "Negotiating closing fee between %s and %s satoshi (ideal %s) " diff --git a/closingd/closingd_wire.csv b/closingd/closingd_wire.csv index c6f7ea07f..4558c9a98 100644 --- a/closingd/closingd_wire.csv +++ b/closingd/closingd_wire.csv @@ -26,13 +26,6 @@ msgdata,closingd_init,remote_scriptpubkey_len,u16, msgdata,closingd_init,remote_scriptpubkey,u8,remote_scriptpubkey_len msgdata,closingd_init,fee_negotiation_step,u64, msgdata,closingd_init,fee_negotiation_step_unit,u8, -msgdata,closingd_init,reconnected,bool, -msgdata,closingd_init,next_index_local,u64, -msgdata,closingd_init,next_index_remote,u64, -msgdata,closingd_init,revocations_received,u64, -msgdata,closingd_init,channel_reestablish_len,u16, -msgdata,closingd_init,channel_reestablish,u8,channel_reestablish_len -msgdata,closingd_init,last_remote_secret,secret, msgdata,closingd_init,dev_fast_gossip,bool, msgdata,closingd_init,shutdown_wrong_funding,?bitcoin_outpoint, diff --git a/closingd/closingd_wiregen.c b/closingd/closingd_wiregen.c index d1a94dfb5..ca64732c0 100644 --- a/closingd/closingd_wiregen.c +++ b/closingd/closingd_wiregen.c @@ -48,11 +48,10 @@ bool closingd_wire_is_defined(u16 type) /* WIRE: CLOSINGD_INIT */ /* Begin! (passes peer fd */ -u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct per_peer_state *pps, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, const struct pubkey *local_fundingkey, const struct pubkey *remote_fundingkey, enum side opener, struct amount_sat local_sat, struct amount_sat remote_sat, struct amount_sat our_dust_limit, struct amount_sat min_fee_satoshi, struct amount_sat fee_limit_satoshi, struct amount_sat initial_fee_satoshi, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, u64 fee_negotiation_step, u8 fee_negotiation_step_unit, bool reconnected, u64 next_index_local, u64 next_index_remote, u64 revocations_received, const u8 *channel_reestablish, const struct secret *last_remote_secret, bool dev_fast_gossip, const struct bitcoin_outpoint *shutdown_wrong_funding) +u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct per_peer_state *pps, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, const struct pubkey *local_fundingkey, const struct pubkey *remote_fundingkey, enum side opener, struct amount_sat local_sat, struct amount_sat remote_sat, struct amount_sat our_dust_limit, struct amount_sat min_fee_satoshi, struct amount_sat fee_limit_satoshi, struct amount_sat initial_fee_satoshi, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, u64 fee_negotiation_step, u8 fee_negotiation_step_unit, bool dev_fast_gossip, const struct bitcoin_outpoint *shutdown_wrong_funding) { u16 local_scriptpubkey_len = tal_count(local_scriptpubkey); u16 remote_scriptpubkey_len = tal_count(remote_scriptpubkey); - u16 channel_reestablish_len = tal_count(channel_reestablish); u8 *p = tal_arr(ctx, u8, 0); towire_u16(&p, WIRE_CLOSINGD_INIT); @@ -77,13 +76,6 @@ u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams towire_u8_array(&p, remote_scriptpubkey, remote_scriptpubkey_len); towire_u64(&p, fee_negotiation_step); towire_u8(&p, fee_negotiation_step_unit); - towire_bool(&p, reconnected); - towire_u64(&p, next_index_local); - towire_u64(&p, next_index_remote); - towire_u64(&p, revocations_received); - towire_u16(&p, channel_reestablish_len); - towire_u8_array(&p, channel_reestablish, channel_reestablish_len); - towire_secret(&p, last_remote_secret); towire_bool(&p, dev_fast_gossip); if (!shutdown_wrong_funding) towire_bool(&p, false); @@ -94,11 +86,10 @@ u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams return memcheck(p, tal_count(p)); } -bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct per_peer_state **pps, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, struct pubkey *local_fundingkey, struct pubkey *remote_fundingkey, enum side *opener, struct amount_sat *local_sat, struct amount_sat *remote_sat, struct amount_sat *our_dust_limit, struct amount_sat *min_fee_satoshi, struct amount_sat *fee_limit_satoshi, struct amount_sat *initial_fee_satoshi, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, u64 *fee_negotiation_step, u8 *fee_negotiation_step_unit, bool *reconnected, u64 *next_index_local, u64 *next_index_remote, u64 *revocations_received, u8 **channel_reestablish, struct secret *last_remote_secret, bool *dev_fast_gossip, struct bitcoin_outpoint **shutdown_wrong_funding) +bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct per_peer_state **pps, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, struct pubkey *local_fundingkey, struct pubkey *remote_fundingkey, enum side *opener, struct amount_sat *local_sat, struct amount_sat *remote_sat, struct amount_sat *our_dust_limit, struct amount_sat *min_fee_satoshi, struct amount_sat *fee_limit_satoshi, struct amount_sat *initial_fee_satoshi, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, u64 *fee_negotiation_step, u8 *fee_negotiation_step_unit, bool *dev_fast_gossip, struct bitcoin_outpoint **shutdown_wrong_funding) { u16 local_scriptpubkey_len; u16 remote_scriptpubkey_len; - u16 channel_reestablish_len; const u8 *cursor = p; size_t plen = tal_count(p); @@ -130,15 +121,6 @@ bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainp fromwire_u8_array(&cursor, &plen, *remote_scriptpubkey, remote_scriptpubkey_len); *fee_negotiation_step = fromwire_u64(&cursor, &plen); *fee_negotiation_step_unit = fromwire_u8(&cursor, &plen); - *reconnected = fromwire_bool(&cursor, &plen); - *next_index_local = fromwire_u64(&cursor, &plen); - *next_index_remote = fromwire_u64(&cursor, &plen); - *revocations_received = fromwire_u64(&cursor, &plen); - channel_reestablish_len = fromwire_u16(&cursor, &plen); - // 2nd case channel_reestablish - *channel_reestablish = channel_reestablish_len ? tal_arr(ctx, u8, channel_reestablish_len) : NULL; - fromwire_u8_array(&cursor, &plen, *channel_reestablish, channel_reestablish_len); - fromwire_secret(&cursor, &plen, last_remote_secret); *dev_fast_gossip = fromwire_bool(&cursor, &plen); if (!fromwire_bool(&cursor, &plen)) *shutdown_wrong_funding = NULL; @@ -213,4 +195,4 @@ bool fromwire_closingd_complete(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:8a13df246be151bcef3dae15a9853016119248d330e76ab79d7013a11d5ecd23 +// SHA256STAMP:b08cf96b79e7a72bb574d0549148dd521d77834454a528fb13ee5b83d4942573 diff --git a/closingd/closingd_wiregen.h b/closingd/closingd_wiregen.h index 9f46a12b9..9d1eeb404 100644 --- a/closingd/closingd_wiregen.h +++ b/closingd/closingd_wiregen.h @@ -37,8 +37,8 @@ bool closingd_wire_is_defined(u16 type); /* WIRE: CLOSINGD_INIT */ /* Begin! (passes peer fd */ -u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct per_peer_state *pps, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, const struct pubkey *local_fundingkey, const struct pubkey *remote_fundingkey, enum side opener, struct amount_sat local_sat, struct amount_sat remote_sat, struct amount_sat our_dust_limit, struct amount_sat min_fee_satoshi, struct amount_sat fee_limit_satoshi, struct amount_sat initial_fee_satoshi, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, u64 fee_negotiation_step, u8 fee_negotiation_step_unit, bool reconnected, u64 next_index_local, u64 next_index_remote, u64 revocations_received, const u8 *channel_reestablish, const struct secret *last_remote_secret, bool dev_fast_gossip, const struct bitcoin_outpoint *shutdown_wrong_funding); -bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct per_peer_state **pps, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, struct pubkey *local_fundingkey, struct pubkey *remote_fundingkey, enum side *opener, struct amount_sat *local_sat, struct amount_sat *remote_sat, struct amount_sat *our_dust_limit, struct amount_sat *min_fee_satoshi, struct amount_sat *fee_limit_satoshi, struct amount_sat *initial_fee_satoshi, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, u64 *fee_negotiation_step, u8 *fee_negotiation_step_unit, bool *reconnected, u64 *next_index_local, u64 *next_index_remote, u64 *revocations_received, u8 **channel_reestablish, struct secret *last_remote_secret, bool *dev_fast_gossip, struct bitcoin_outpoint **shutdown_wrong_funding); +u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct per_peer_state *pps, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, const struct pubkey *local_fundingkey, const struct pubkey *remote_fundingkey, enum side opener, struct amount_sat local_sat, struct amount_sat remote_sat, struct amount_sat our_dust_limit, struct amount_sat min_fee_satoshi, struct amount_sat fee_limit_satoshi, struct amount_sat initial_fee_satoshi, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, u64 fee_negotiation_step, u8 fee_negotiation_step_unit, bool dev_fast_gossip, const struct bitcoin_outpoint *shutdown_wrong_funding); +bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct per_peer_state **pps, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, struct pubkey *local_fundingkey, struct pubkey *remote_fundingkey, enum side *opener, struct amount_sat *local_sat, struct amount_sat *remote_sat, struct amount_sat *our_dust_limit, struct amount_sat *min_fee_satoshi, struct amount_sat *fee_limit_satoshi, struct amount_sat *initial_fee_satoshi, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, u64 *fee_negotiation_step, u8 *fee_negotiation_step_unit, bool *dev_fast_gossip, struct bitcoin_outpoint **shutdown_wrong_funding); /* WIRE: CLOSINGD_RECEIVED_SIGNATURE */ /* We received an offer */ @@ -56,4 +56,4 @@ bool fromwire_closingd_complete(const void *p); #endif /* LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H */ -// SHA256STAMP:8a13df246be151bcef3dae15a9853016119248d330e76ab79d7013a11d5ecd23 +// SHA256STAMP:b08cf96b79e7a72bb574d0549148dd521d77834454a528fb13ee5b83d4942573 diff --git a/common/dev_disconnect.c b/common/dev_disconnect.c index e5a1a6f96..ab8302a29 100644 --- a/common/dev_disconnect.c +++ b/common/dev_disconnect.c @@ -107,9 +107,11 @@ void dev_sabotage_fd(int fd, bool close_fd) #endif /* Move fd out the way if we don't want to close it. */ - if (!close_fd) - dup(fd); - else + if (!close_fd) { + if (dup(fd) == -1) { + ; /* -Wunused-result */ + } + } else /* Close other end of socket. */ close(fds[0]); diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index a322fe57e..380146c66 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -315,12 +315,15 @@ static void peer_start_closingd_after_shutdown(struct channel *channel, per_peer_state_set_fds_arr(pps, fds); /* This sets channel->owner, closes down channeld. */ - peer_start_closingd(channel, pps, false, NULL); - channel_set_state(channel, - CHANNELD_SHUTTING_DOWN, - CLOSINGD_SIGEXCHANGE, - REASON_UNKNOWN, - "Start closingd"); + peer_start_closingd(channel, pps); + + /* We might have reconnected, so already be here. */ + if (channel->state != CLOSINGD_SIGEXCHANGE) + channel_set_state(channel, + CHANNELD_SHUTTING_DOWN, + CLOSINGD_SIGEXCHANGE, + REASON_UNKNOWN, + "Start closingd"); } static void forget(struct channel *channel) @@ -619,7 +622,8 @@ void peer_start_channeld(struct channel *channel, channel->remote_funding_locked, &scid, reconnected, - channel->state == CHANNELD_SHUTTING_DOWN, + channel->state == CHANNELD_SHUTTING_DOWN + || channel->state == CLOSINGD_SIGEXCHANGE, channel->shutdown_scriptpubkey[REMOTE] != NULL, channel->shutdown_scriptpubkey[LOCAL], channel->channel_flags, diff --git a/lightningd/closing_control.c b/lightningd/closing_control.c index a4769cdf8..0729ee76d 100644 --- a/lightningd/closing_control.c +++ b/lightningd/closing_control.c @@ -193,17 +193,13 @@ static unsigned closing_msg(struct subd *sd, const u8 *msg, const int *fds UNUSE } void peer_start_closingd(struct channel *channel, - struct per_peer_state *pps, - bool reconnected, - const u8 *channel_reestablish) + struct per_peer_state *pps) { u8 *initmsg; u32 feerate; struct amount_sat minfee, startfee, feelimit; - u64 num_revocations; struct amount_msat their_msat; int hsmfd; - struct secret last_remote_per_commit_secret; struct lightningd *ld = channel->peer->ld; u32 final_commit_feerate; @@ -270,9 +266,6 @@ void peer_start_closingd(struct channel *channel, if (amount_sat_greater(minfee, feelimit)) minfee = feelimit; - num_revocations - = revocations_received(&channel->their_shachain.chain); - /* BOLT #3: * * Each node offering a signature: @@ -292,25 +285,6 @@ void peer_start_closingd(struct channel *channel, return; } - /* BOLT #2: - * - if `next_revocation_number` equals 0: - * - MUST set `your_last_per_commitment_secret` to all zeroes - * - otherwise: - * - MUST set `your_last_per_commitment_secret` to the last - * `per_commitment_secret` it received - */ - if (num_revocations == 0) - memset(&last_remote_per_commit_secret, 0, - sizeof(last_remote_per_commit_secret)); - else if (!shachain_get_secret(&channel->their_shachain.chain, - num_revocations-1, - &last_remote_per_commit_secret)) { - channel_fail_permanent(channel, - REASON_LOCAL, - "Could not get revocation secret %"PRIu64, - num_revocations-1); - return; - } initmsg = towire_closingd_init(tmpctx, chainparams, pps, @@ -329,12 +303,6 @@ void peer_start_closingd(struct channel *channel, channel->shutdown_scriptpubkey[REMOTE], channel->closing_fee_negotiation_step, channel->closing_fee_negotiation_step_unit, - reconnected, - channel->next_index[LOCAL], - channel->next_index[REMOTE], - num_revocations, - channel_reestablish, - &last_remote_per_commit_secret, IFDEV(ld->dev_fast_gossip, false), channel->shutdown_wrong_funding); diff --git a/lightningd/closing_control.h b/lightningd/closing_control.h index cbaa76ab9..0ee6afb29 100644 --- a/lightningd/closing_control.h +++ b/lightningd/closing_control.h @@ -3,13 +3,10 @@ #include "config.h" #include -struct channel_id; -struct crypto_state; +struct channel; struct per_peer_state; void peer_start_closingd(struct channel *channel, - struct per_peer_state *pps, - bool reconnected, - const u8 *channel_reestablish); + struct per_peer_state *pps); #endif /* LIGHTNING_LIGHTNINGD_CLOSING_CONTROL_H */ diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index ac9e1f6ef..887611e53 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -1293,7 +1293,7 @@ static void handle_channel_closed(struct subd *dualopend, per_peer_state_set_fds_arr(pps, fds); - peer_start_closingd(channel, pps, false, NULL); + peer_start_closingd(channel, pps); channel_set_state(channel, CHANNELD_SHUTTING_DOWN, CLOSINGD_SIGEXCHANGE, diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 769557cc7..85363ee0d 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1131,17 +1131,11 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa case CHANNELD_AWAITING_LOCKIN: case CHANNELD_NORMAL: case CHANNELD_SHUTTING_DOWN: - assert(!channel->owner); - channel->peer->addr = addr; - channel->peer->connected_incoming = payload->incoming; - peer_start_channeld(channel, payload->pps, NULL, true); - return; - case CLOSINGD_SIGEXCHANGE: assert(!channel->owner); channel->peer->addr = addr; channel->peer->connected_incoming = payload->incoming; - peer_start_closingd(channel, payload->pps, true, NULL); + peer_start_channeld(channel, payload->pps, NULL, true); return; } abort(); diff --git a/lightningd/test/run-invoice-select-inchan.c b/lightningd/test/run-invoice-select-inchan.c index 34b7e7e56..830dd1b28 100644 --- a/lightningd/test/run-invoice-select-inchan.c +++ b/lightningd/test/run-invoice-select-inchan.c @@ -603,12 +603,6 @@ void peer_start_channeld(struct channel *channel UNNEEDED, const u8 *fwd_msg UNNEEDED, bool reconnected UNNEEDED) { fprintf(stderr, "peer_start_channeld called!\n"); abort(); } -/* Generated stub for peer_start_closingd */ -void peer_start_closingd(struct channel *channel UNNEEDED, - struct per_peer_state *pps UNNEEDED, - bool reconnected 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) { fprintf(stderr, "peer_start_dualopend called!\n"); abort(); } diff --git a/tests/test_closing.py b/tests/test_closing.py index 66ee0052b..df924d71f 100644 --- a/tests/test_closing.py +++ b/tests/test_closing.py @@ -2742,7 +2742,6 @@ def test_shutdown_alternate_txid(node_factory, bitcoind): wait_for(lambda: l1.rpc.listpeers()['peers'] == []) -@pytest.mark.xfail(strict=True) @pytest.mark.developer("needs dev_disconnect") def test_htlc_rexmit_while_closing(node_factory, executor): """Retranmitting an HTLC revocation while shutting down should work""" diff --git a/tests/test_connection.py b/tests/test_connection.py index 413055014..4f808af91 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -588,7 +588,7 @@ def test_reconnect_no_update(node_factory, executor, bitcoind): # Close will trigger the @WIRE_SHUTDOWN and we then wait for the # automatic reconnection to trigger the retransmission. l1.rpc.close(l2.info['id'], 0) - l2.daemon.wait_for_log(r"closingd.* Retransmitting funding_locked for channel") + l2.daemon.wait_for_log(r"channeld.* Retransmitting funding_locked for channel") l1.daemon.wait_for_log(r"CLOSINGD_COMPLETE") diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index e85d5929d..c5539b463 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -1924,4 +1924,4 @@ struct db_query db_postgres_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ -// SHA256STAMP:dbbcb7d784e7b3d6c7b27c2ff976dcc39335fdc26fbf095b65116488007799f7 +// SHA256STAMP:8402c09aa5503dcdb757a37cc9e4ef0b2a5ecddc773ace28eb380889152090ae diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 5b6eb8fa0..437aaa9a9 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -1924,4 +1924,4 @@ struct db_query db_sqlite3_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:dbbcb7d784e7b3d6c7b27c2ff976dcc39335fdc26fbf095b65116488007799f7 +// SHA256STAMP:8402c09aa5503dcdb757a37cc9e4ef0b2a5ecddc773ace28eb380889152090ae diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index 030daf206..aebf41691 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -1262,11 +1262,11 @@ msgstr "" msgid "not a valid SQL statement" msgstr "" -#: wallet/test/run-wallet.c:1455 +#: wallet/test/run-wallet.c:1449 msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;" msgstr "" -#: wallet/test/run-wallet.c:1653 +#: wallet/test/run-wallet.c:1647 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:e3c8d5cac8615668f0c9f37ebf6edff3b18833bafdf9643c2203b2a4ab654b7c +# SHA256STAMP:5e19a14e405e7a16bdd2e8e3f5bd482f69a83f3cbc1febb8e60a5657bf143be3 diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index c95aca7cb..0c4e4189a 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -649,12 +649,6 @@ void peer_start_channeld(struct channel *channel UNNEEDED, const u8 *fwd_msg UNNEEDED, bool reconnected UNNEEDED) { fprintf(stderr, "peer_start_channeld called!\n"); abort(); } -/* Generated stub for peer_start_closingd */ -void peer_start_closingd(struct channel *channel UNNEEDED, - struct per_peer_state *pps UNNEEDED, - bool reconnected 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) { fprintf(stderr, "peer_start_dualopend called!\n"); abort(); }