mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 06:44:24 +01:00
common: support opt_shutdown_anysegwit checks (EXPERIMENTAL_FEATURES).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -227,6 +227,9 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
|
||||
{
|
||||
u8 *scriptpubkey;
|
||||
struct lightningd *ld = channel->peer->ld;
|
||||
bool anysegwit = feature_negotiated(ld->our_features,
|
||||
channel->peer->their_features,
|
||||
OPT_SHUTDOWN_ANYSEGWIT);
|
||||
|
||||
if (!fromwire_channeld_got_shutdown(channel, msg, &scriptpubkey)) {
|
||||
channel_internal_error(channel, "bad channel_got_shutdown %s",
|
||||
@@ -238,7 +241,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)) {
|
||||
if (!valid_shutdown_scriptpubkey(scriptpubkey, anysegwit)) {
|
||||
channel_fail_permanent(channel,
|
||||
REASON_PROTOCOL,
|
||||
"Bad shutdown scriptpubkey %s",
|
||||
|
||||
@@ -809,6 +809,7 @@ static struct feature_set *default_features(const tal_t *ctx)
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
OPTIONAL_FEATURE(OPT_ANCHOR_OUTPUTS),
|
||||
OPTIONAL_FEATURE(OPT_ONION_MESSAGES),
|
||||
OPTIONAL_FEATURE(OPT_SHUTDOWN_ANYSEGWIT),
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user