diff --git a/lightningd/dual_open_control.c b/lightningd/dual_open_control.c index 7f1d50993..279c4bb96 100644 --- a/lightningd/dual_open_control.c +++ b/lightningd/dual_open_control.c @@ -437,8 +437,23 @@ openchannel2_hook_deserialize(struct openchannel2_payload *payload, json_tok_full(buffer, toks)); if (json_tok_streq(buffer, t_result, "reject")) { + /* Should not have set any other fields if 'reject'ing */ + if (json_get_member(buffer, toks, "close_to")) + fatal("Plugin rejected openchannel2 but" + " also set close_to"); + if (json_get_member(buffer, toks, "psbt")) + fatal("Plugin rejected openchannel2 but" + " also set `psbt`"); + if (json_get_member(buffer, toks, "accepter_funding_msat")) + fatal("Plugin rejected openchannel2 but" + " also set `accepter_funding_psbt`"); + if (json_get_member(buffer, toks, "funding_feerate")) + fatal("Plugin rejected openchannel2 but" + " also set `funding_feerate`"); + const jsmntok_t *t_errmsg = json_get_member(buffer, toks, "error_message"); + if (t_errmsg) payload->err_msg = json_strdup(payload, buffer, t_errmsg); diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 7af79f40e..e110b7349 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -625,9 +625,9 @@ def test_openchannel_hook_error_handling(node_factory, bitcoind): l1.fundwallet(10**6) # next fundchannel should fail fatal() for l2 - with pytest.raises(RpcError, match=r'Owning subdaemon openingd died'): + with pytest.raises(RpcError, match=r'Owning subdaemon (openingd|dualopend) died'): l1.rpc.fundchannel(l2.info['id'], 100004) - assert l2.daemon.is_in_log("BROKEN.*Plugin rejected openchannel but also set close_to") + assert l2.daemon.is_in_log("BROKEN.*Plugin rejected openchannel[2]? but also set close_to") def test_openchannel_hook_chaining(node_factory, bitcoind):