Class ShutdownScript


  • public class ShutdownScript
    extends Object
    A script pubkey for shutting down a channel as defined by [BOLT #2]. [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md
    • Method Detail

      • write

        public byte[] write()
        Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
      • new_p2pkh

        public static ShutdownScript new_p2pkh​(byte[] pubkey_hash)
        Generates a P2PKH script pubkey from the given [`PubkeyHash`].
      • new_p2sh

        public static ShutdownScript new_p2sh​(byte[] script_hash)
        Generates a P2SH script pubkey from the given [`ScriptHash`].
      • new_p2wpkh

        public static ShutdownScript new_p2wpkh​(byte[] pubkey_hash)
        Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].
      • new_p2wsh

        public static ShutdownScript new_p2wsh​(byte[] script_hash)
        Generates a P2WSH script pubkey from the given [`WScriptHash`].
      • new_witness_program

        public static Result_ShutdownScriptInvalidShutdownScriptZ new_witness_program​(byte version,
                                                                                      byte[] program)
        Generates a witness script pubkey from the given segwit version and program. Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or [`ShutdownScript::new_p2wsh`] instead. # Errors This function may return an error if `program` is invalid for the segwit `version`.
      • into_inner

        public byte[] into_inner()
        Converts the shutdown script into the underlying [`Script`].
      • as_legacy_pubkey

        @Nullable
        public byte[] as_legacy_pubkey()
        Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it. Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
      • is_compatible

        public boolean is_compatible​(InitFeatures features)
        Returns whether the shutdown script is compatible with the features as defined by BOLT #2. Specifically, checks for compliance with feature `option_shutdown_anysegwit`.