Skip to content

Commit 3190c26

Browse files
niftyneirustyrussell
authored andcommitted
dualfund: error on out of order sigs
We weren't blocking if the tx-sigs arrived before the commitment sigs. This was causing problems in the openchannel (spender plugin) spenderp: FATAL SIGNAL 11 (version v23.08.1-404-g62ff475-modded) 0x559836dc98ba send_backtrace common/daemon.c:33 0x559836dc9951 crashdump common/daemon.c:75 0x7f37f42c351f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x7f37f441ac92 ??? ../sysdeps/x86_64/multiarch/memcmp-avx2-movbe.S:83 0x559836db7760 bitcoin_txid_eq ./bitcoin/tx.h:29 0x559836db7760 collect_sigs plugins/spender/openchannel.c:509 0x559836db81de check_sigs_ready plugins/spender/openchannel.c:531 0x559836db84dd json_peer_sigs plugins/spender/openchannel.c:611 0x559836dbcad7 ld_command_handle plugins/libplugin.c:1611 0x559836dbcd9d ld_read_json_one plugins/libplugin.c:1721 0x559836dbce29 ld_read_json plugins/libplugin.c:1741 0x559836ef3bff next_plan ccan/ccan/io/io.c:59 0x559836ef40da do_plan ccan/ccan/io/io.c:407 0x559836ef4177 io_ready ccan/ccan/io/io.c:417 0x559836ef5b14 io_loop ccan/ccan/io/poll.c:453 0x559836dbd48d plugin_main plugins/libplugin.c:1948 0x559836db22bf main plugins/spender/main.c:35 0x7f37f42aad8f __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 0x7f37f42aae3f __libc_start_main_impl ../csu/libc-start.c:392 0x559836da3774 ??? ???:0 0xffffffffffffffff ??? ???:0 2023-10-31T15:15:57.458Z INFO plugin-spenderp: Killing plugin: exited during normal operation 2023-10-31T15:15:57.458Z **BROKEN** plugin-spenderp: Plugin marked as important, shutting down lightningd! 2023-10-31T15:15:57.458Z DEBUG lightningd: io_break: lightningd_exit 2023-10-31T15:15:57.458Z DEBUG lightningd: io_loop_with_timers: main 2023-10-31T15:15:57.458Z DEBUG connectd: REPLY WIRE_CONNECTD_START_SHUTDOWN_REPLY with 0 fds 2023-10-31T15:15:57.458Z DEBUG lightningd: io_break: connectd_start_shutdown_reply 2023-10-31T15:15:57.458Z DEBUG 021ccce7bc396996c8f3b7bfeb1e30c6600269517026a74adfe2217b7187879797-dualopend-chan#1: Status closed, but not exited. Killing 2023-10-31T15:15:57.458Z DEBUG lightningd: Command returned result after jcon close 2023-10-31T15:15:57.458Z INFO 021ccce7bc396996c8f3b7bfeb1e30c6600269517026a74adfe2217b7187879797-chan#1: Unsaved peer failed. Deleting channel. 2023-10-31T15:15:57.464Z DEBUG lightningd: io_break: destroy_plugin 2023-10-31T15:15:57.464Z DEBUG connectd: Shutting down 2023-10-31T15:15:57.464Z DEBUG gossipd: Shutting down 2023-10-31T15:15:57.464Z DEBUG hsmd: Shutting down Reported-By: @t-bast
1 parent fa8458c commit 3190c26

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

openingd/dualopend.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,7 @@ static char *do_commit_signed_received(const tal_t *ctx,
12521252
tx_state->psbt));
12531253
}
12541254

1255+
tx_state->has_commitments = true;
12551256
return NULL;
12561257
}
12571258

@@ -1345,6 +1346,11 @@ static void handle_tx_sigs(struct state *state, const u8 *msg)
13451346
struct bitcoin_txid,
13461347
&tx_state->funding.txid));
13471348

1349+
if (!tx_state->has_commitments)
1350+
open_err_fatal(state,
1351+
"tx_signatures sent before commitment sigs %s",
1352+
tal_hex(msg, msg));
1353+
13481354
/* We put the PSBT + sigs all together */
13491355
for (size_t i = 0, j = 0; i < tx_state->psbt->num_inputs; i++) {
13501356
struct wally_psbt_input *in =

tests/test_opening.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ def test_v2_open_sigs_reconnect_1(node_factory, bitcoind):
217217

218218

219219
@unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need')
220-
@pytest.mark.xfail
221220
@pytest.mark.openchannel('v2')
222221
def test_v2_open_sigs_out_of_order(node_factory, bitcoind):
223222
""" Test what happens if the tx-sigs get sent "before" commitment signed """

0 commit comments

Comments
 (0)