mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
shutdown: don't allow shutdown to p2pkh or p2sh addresses for anchor outputs.
This doesn't have an effect now (except in experimental mode), but it will when we support anchors. So we deprecate the use of those in the close command too. For experimental mode we have to avoid using p2pkh; adapt that test. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Deprecated: JSON-RPC: `shutdown` no longer allows p2pkh or p2sh addresses.
This commit is contained in:
@@ -275,6 +275,12 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
|
||||
bool anysegwit = feature_negotiated(ld->our_features,
|
||||
channel->peer->their_features,
|
||||
OPT_SHUTDOWN_ANYSEGWIT);
|
||||
bool anchors = feature_negotiated(ld->our_features,
|
||||
channel->peer->their_features,
|
||||
OPT_ANCHOR_OUTPUTS)
|
||||
|| feature_negotiated(ld->our_features,
|
||||
channel->peer->their_features,
|
||||
OPT_ANCHORS_ZERO_FEE_HTLC_TX);
|
||||
|
||||
if (!fromwire_channeld_got_shutdown(channel, msg, &scriptpubkey,
|
||||
&wrong_funding)) {
|
||||
@@ -287,7 +293,7 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
|
||||
tal_free(channel->shutdown_scriptpubkey[REMOTE]);
|
||||
channel->shutdown_scriptpubkey[REMOTE] = scriptpubkey;
|
||||
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit)) {
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit, anchors)) {
|
||||
channel_fail_permanent(channel,
|
||||
REASON_PROTOCOL,
|
||||
"Bad shutdown scriptpubkey %s",
|
||||
|
||||
Reference in New Issue
Block a user