Support all shutdown scripts defined in BOLT 2
authorJeffrey Czyz <jkczyz@gmail.com>
Mon, 26 Jul 2021 16:31:24 +0000 (12:31 -0400)
committerJeffrey Czyz <jkczyz@gmail.com>
Sat, 31 Jul 2021 05:13:31 +0000 (00:13 -0500)
commit73e7f4d6e2dd642f85e11fb0ce94955948442224
tree91df4b070b0e6d91d392681285051b16061c48af
parente1eb69aaa503c2e4657d982912838ed7998a37f9
Support all shutdown scripts defined in BOLT 2

KeysInterface::get_shutdown_pubkey is used to form P2WPKH shutdown
scripts. However, BOLT 2 allows for a wider variety of scripts. Refactor
KeysInterface to allow any supported script while still maintaining
serialization backwards compatibility with P2WPKH script pubkeys stored
simply as the PublicKey.

Add an optional TLV field to Channel and ChannelMonitor to support the
new format, but continue to serialize the legacy PublicKey format.
fuzz/src/chanmon_consistency.rs
fuzz/src/full_stack.rs
lightning/src/chain/channelmonitor.rs
lightning/src/chain/keysinterface.rs
lightning/src/ln/channel.rs
lightning/src/ln/script.rs
lightning/src/util/test_utils.rs