mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-20 21:44:29 +01:00
lightningd: only allow closing to native segwit
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Removed: JSON-RPC: `close` `destination` no longer allows p2pkh or p2sh addresses (deprecated v0.11.0)
This commit is contained in:
@@ -315,7 +315,7 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
|
||||
* - if the `scriptpubkey` is not in one of the above forms:
|
||||
* - SHOULD send a `warning`.
|
||||
*/
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, anchors)) {
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, !anchors)) {
|
||||
u8 *warning = towire_warningfmt(NULL,
|
||||
&channel->cid,
|
||||
"Bad shutdown scriptpubkey %s",
|
||||
|
||||
@@ -724,11 +724,11 @@ static struct command_result *json_close(struct command *cmd,
|
||||
channel->peer->their_features,
|
||||
OPT_SHUTDOWN_ANYSEGWIT);
|
||||
if (!valid_shutdown_scriptpubkey(channel->shutdown_scriptpubkey[LOCAL],
|
||||
anysegwit, !deprecated_apis)) {
|
||||
anysegwit, false)) {
|
||||
/* Explicit check for future segwits. */
|
||||
if (!anysegwit &&
|
||||
valid_shutdown_scriptpubkey(channel->shutdown_scriptpubkey
|
||||
[LOCAL], true, !deprecated_apis)) {
|
||||
[LOCAL], true, false)) {
|
||||
return command_fail(cmd, JSONRPC2_INVALID_PARAMS,
|
||||
"Peer does not allow v1+ shutdown addresses");
|
||||
}
|
||||
|
||||
@@ -1364,7 +1364,7 @@ static void handle_peer_wants_to_close(struct subd *dualopend,
|
||||
* - if the `scriptpubkey` is not in one of the above forms:
|
||||
* - SHOULD send a `warning`
|
||||
*/
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, anchors)) {
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, !anchors)) {
|
||||
u8 *warning = towire_warningfmt(NULL,
|
||||
&channel->cid,
|
||||
"Bad shutdown scriptpubkey %s",
|
||||
|
||||
Reference in New Issue
Block a user