Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,16 @@ void resend_opening_transactions(struct lightningd *ld)
peer = peer_node_id_map_next(ld->peers, &it)) {
list_for_each(&peer->channels, channel, list) {
struct wally_tx *wtx;
if (channel_state_uncommitted(channel->state))
/* Only states where the funding/splice tx might
* still be unconfirmed. channel->depth can't be
* used here: it's reset to 0 on DB load and only
* repopulated once topology starts. */
if (channel->state != CHANNELD_AWAITING_LOCKIN
&& channel->state != DUALOPEND_AWAITING_LOCKIN
&& channel->state != CHANNELD_AWAITING_SPLICE)
continue;
if (!channel->funding_psbt || channel->withheld)
continue;
if (channel->depth != 0)
continue;
wtx = psbt_final_tx(tmpctx, channel->funding_psbt);
if (!wtx)
continue;
Expand Down
16 changes: 16 additions & 0 deletions tests/test_opening.py
Original file line number Diff line number Diff line change
Expand Up @@ -3018,3 +3018,19 @@ def test_zeroconf_withhold_htlc_failback(node_factory, bitcoind):

# l1's channel to l2 is still normal — no force-close
assert only_one(l1.rpc.listpeerchannels(l2.info['id'])['channels'])['state'] == 'CHANNELD_NORMAL'


@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
def test_no_retransmit_confirmed_funding(node_factory):
"""An channel must not trigger funding tx re-transmission on restart."""
l1, _ = node_factory.line_graph(2, wait_for_announce=True)

# Channel is in CHANNELD_NORMAL and funding tx is confirmed.
assert only_one(l1.rpc.listpeerchannels()['channels'])['state'] == 'CHANNELD_NORMAL'

l1.restart()

# Should not have attempted (and failed) to re-broadcast the funding tx.
assert not l1.daemon.is_in_log('Failed to re-transmit funding tx')
assert not l1.daemon.is_in_log('Successfully rexmitted funding tx')
Loading