Add support for `opt_shutdown_anysegwit` feature #780
authorGalder Zamarreño <galder@redhat.com>
Fri, 5 Feb 2021 14:14:12 +0000 (15:14 +0100)
committerGalder Zamarreño <galder@redhat.com>
Thu, 25 Feb 2021 13:28:08 +0000 (14:28 +0100)
commit24ed1dc2ecfe449f2f280d05c3f1989be280e37f
tree0abbf377855deffbe36f5b270c617cb9a9500c93
parentd6f41d3c0b38b9ec9e06a3acfdd9f4b1d007a27d
Add support for `opt_shutdown_anysegwit` feature #780

* Implemented protocol.
* Made feature optional.
* Verify that the default value is true.
* Verify that on shutdown,
if Channel.supports_shutdown_anysegwit is enabled,
the script can be a witness program.
* Added a test that verifies that a scriptpubkey
for an unreleased segwit version is handled successfully.
* Added a test that verifies that
if node has op_shutdown_anysegwit disabled,
a scriptpubkey with an unreleased segwit version on shutdown
throws an error.
* Added peer InitFeatures to handle_shutdown
* Check if shutdown script is valid when given upfront.
* Added a test to verify that an invalid test results in error.
* Added a test to check that if a segwit script with version 0 is provided,
the updated anysegwit check detects it and returns unsupported.
* An empty script is only allowed when sent as upfront shutdown script,
so make sure that check is only done for accept/open_channel situations.
* Instead of reimplementing a variant of is_witness_script,
just call it and verify that the witness version is not 0.
lightning-net-tokio/src/lib.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/features.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/msgs.rs
lightning/src/ln/peer_handler.rs
lightning/src/util/test_utils.rs