Commit graph

6 commits

Author SHA1 Message Date
Matt Corallo
13e4fd586e Test fixed channel reserve checks on channel open 2021-11-23 01:20:43 +00:00
Matt Corallo
1b70d9ee8f Require user cooperative close payout scripts to be Segwit
There is little reason for users to be paying out to non-Segwit
scripts when closing channels at this point. Given we will soon, in
rare cases, force-close during shutdown when a counterparty closes
to a non-Segwit script, we should also require it of our own users.
2021-09-27 18:19:51 +00:00
Matt Corallo
35d0b7aae7 Clarify docs on ShutdownScript::new_witness_program somewhat
This is especially important for C or other language bindings
clients as the `version` field may be exported as a `u8`.
2021-08-17 21:12:06 +00:00
Jeffrey Czyz
4a44bfa3a4
Implement Display for ShutdownScript 2021-08-09 15:56:29 -05:00
Jeffrey Czyz
ccd11fc35a
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.
2021-08-09 15:55:26 -05:00
Jeffrey Czyz
ecc70757f9
Add ShutdownScript for BOLT 2 acceptable scripts
BOLT 2 enumerates the script formats that may be used for a shutdown
script. KeysInterface::get_shutdown_pubkey returns a PublicKey used to
form one of the acceptable formats (P2WPKH). Add a ShutdownScript
abstraction to encapsulate all accept formats and be backwards
compatible with P2WPKH scripts serialized as the corresponding
PublicKey.
2021-08-09 15:55:25 -05:00