diff --git a/lightningd/closing_control.c b/lightningd/closing_control.c index 50181eda4a45..f6f7ff467c4f 100644 --- a/lightningd/closing_control.c +++ b/lightningd/closing_control.c @@ -692,7 +692,8 @@ static struct command_result *json_close(struct command *cmd, if (close_to_script) { bool is_p2sh; - if (!tal_arr_eq(close_to_script, channel->shutdown_scriptpubkey[LOCAL])) { + if (!tal_arr_eq(close_to_script, channel->shutdown_scriptpubkey[LOCAL]) + && !cmd->ld->dev_allow_shutdown_destination_change) { const u8 *defp2tr, *defp2wpkh; /* We cannot change the closing script once we've * started shutdown: onchaind relies on it for output diff --git a/lightningd/lightningd.c b/lightningd/lightningd.c index 11df5d150e1d..6afd5ac28fc4 100644 --- a/lightningd/lightningd.c +++ b/lightningd/lightningd.c @@ -146,6 +146,7 @@ static struct lightningd *new_lightningd(const tal_t *ctx) ld->dev_disable_commit = -1; ld->dev_no_ping_timer = false; ld->dev_any_channel_type = false; + ld->dev_allow_shutdown_destination_change = false; /*~ This is a CCAN list: an embedded double-linked list. It's not * really typesafe, but relies on convention to access the contents. diff --git a/lightningd/lightningd.h b/lightningd/lightningd.h index 5d6218ab69f5..8f2ddde97602 100644 --- a/lightningd/lightningd.h +++ b/lightningd/lightningd.h @@ -346,6 +346,9 @@ struct lightningd { /* Tell openingd/dualopend to accept all, allow sending any. */ bool dev_any_channel_type; + /* Allow changing of shutdown output point even if dangerous */ + bool dev_allow_shutdown_destination_change; + /* tor support */ struct wireaddr *proxyaddr; bool always_use_proxy; diff --git a/lightningd/options.c b/lightningd/options.c index f535eb1d8d54..0851ef8ad87b 100644 --- a/lightningd/options.c +++ b/lightningd/options.c @@ -911,6 +911,10 @@ static void dev_register_opts(struct lightningd *ld) opt_set_bool, &ld->dev_any_channel_type, "Allow sending any channel type, and accept any"); + clnopt_noarg("--dev-allow-shutdown-destination-change", OPT_DEV, + opt_set_bool, + &ld->dev_allow_shutdown_destination_change, + "Allow destination override on close, even if risky"); } static const struct config testnet_config = {