df-tests: patch for state == AWAITING_UNILATERAL problem

Found on CI where DEVELOPER=0 EXPERIMENTAL_DUAL_FUND=1,
as we turn off automatic reconnects when DEVELOPER=1

This test has been modified to make the error happen every time, and
then fixed.

lightningd-2: 2021-05-07T20:12:03.790Z DEBUG   0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518-chan#1: Peer has reconnected, state AWAITING_UNILATERAL
lightningd-2: 2021-05-07T20:12:03.812Z **BROKEN** lightningd: FATAL SIGNAL 6 (version e8b3f78)
lightningd-2: 2021-05-07T20:12:03.812Z **BROKEN** lightningd: backtrace: common/daemon.c:44 (send_backtrace) 0x56384ee072e9
lightningd-2: 2021-05-07T20:12:03.813Z **BROKEN** lightningd: backtrace: common/daemon.c:52 (crashdump) 0x56384ee0733b

----------------------------- Captured stderr call -----------------------------
lightningd: lightningd/peer_control.c:1100: peer_connected_hook_final: Assertion `channel->state == DUALOPEND_OPEN_INIT || channel->state == DUALOPEND_AWAITING_LOCKIN' failed.
lightningd: FATAL SIGNAL 6 (version e8b3f78)
0x56384ee072a1 send_backtrace
	common/daemon.c:39
0x56384ee0733b crashdump
	common/daemon.c:52
0x7f88486a020f ???
	???:0
0x7f88486a018b ???
	???:0
0x7f884867f858 ???
	???:0
0x7f884867f728 ???
	???:0
0x7f8848690f35 ???
	???:0
0x56384eddc94e peer_connected_hook_final
	lightningd/peer_control.c:1100
0x56384edea2ed plugin_hook_call_
	lightningd/plugin_hook.c:275
0x56384eddfeb8 plugin_hook_call_peer_connected
	lightningd/peer_control.c:1156
0x56384eddfeb8 peer_connected
	lightningd/peer_control.c:1209
0x56384edc30cd connectd_msg
	lightningd/connect_control.c:332
0x56384edebe6f sd_msg_read
	lightningd/subd.c:509
0x56384edebfb1 read_fds
	lightningd/subd.c:310
0x56384ee483b0 next_plan
	ccan/ccan/io/io.c:59
0x56384ee4885b do_plan
	ccan/ccan/io/io.c:407
0x56384ee488f8 io_ready
	ccan/ccan/io/io.c:417
0x56384ee4a23c io_loop
	ccan/ccan/io/poll.c:445
0x56384edcabda io_loop_with_timers
	lightningd/io_loop_with_timers.c:24
0x56384edce826 main
	lightningd/lightningd.c:1111
0x7f88486810b2 ???
	???:0
0x56384edb52ad ???
	???:0
0xffffffffffffffff ???
	???:0
This commit is contained in:
niftynei 2021-05-10 13:46:52 -05:00 committed by Rusty Russell
parent 342f783f53
commit 6d3fb11bc6
2 changed files with 10 additions and 4 deletions

View File

@ -1093,12 +1093,11 @@ send_error:
if (feature_negotiated(ld->our_features,
peer->their_features,
OPT_DUAL_FUND)) {
/* if we have a channel, we're actually restarting
* dualopend. we only get here if there's an error */
if (channel) {
assert(!channel->owner);
assert(channel->state == DUALOPEND_OPEN_INIT
|| channel->state == DUALOPEND_AWAITING_LOCKIN);
|| channel->state == DUALOPEND_AWAITING_LOCKIN
|| channel->state == AWAITING_UNILATERAL);
channel->peer->addr = addr;
channel->peer->connected_incoming = payload->incoming;
peer_restart_dualopend(peer, payload->pps, channel, error);

View File

@ -9,7 +9,8 @@ from utils import (
DEVELOPER, only_one, sync_blockheight, TIMEOUT, wait_for, TEST_NETWORK,
DEPRECATED_APIS, expected_peer_features, expected_node_features,
expected_channel_features, account_balance,
check_coin_moves, first_channel_id, check_coin_moves_idx, EXPERIMENTAL_FEATURES
check_coin_moves, first_channel_id, check_coin_moves_idx,
EXPERIMENTAL_FEATURES, EXPERIMENTAL_DUAL_FUND
)
import ast
@ -846,6 +847,9 @@ def test_channel_state_changed_unilateral(node_factory, bitcoind):
# such errors a soft because LND.
opts = {"plugin": os.path.join(os.getcwd(), "tests/plugins/misc_notifications.py"),
"allow_warning": True}
if EXPERIMENTAL_DUAL_FUND:
opts['may_reconnect'] = True
l1, l2 = node_factory.line_graph(2, opts=opts)
l1_id = l1.rpc.getinfo()["id"]
@ -901,6 +905,9 @@ def test_channel_state_changed_unilateral(node_factory, bitcoind):
wait_for(lambda: len(l1.rpc.listpeers()['peers']) == 1)
# check 'closer' on l2 while the peer is not yet forgotten
assert(l2.rpc.listpeers()['peers'][0]['channels'][0]['closer'] == 'local')
if EXPERIMENTAL_DUAL_FUND:
l1.daemon.wait_for_log(r'Peer has reconnected, state')
l2.daemon.wait_for_log(r'Peer has reconnected, state')
# settle the channel closure
bitcoind.generate_block(100)