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/lightning/bolts/blob/master/02-peer-protocol.md
    • Method Detail

      • eq

        public boolean eq​(ShutdownScript b)
        Checks if two ShutdownScripts contain equal inner contents. This ignores pointers and is_owned flags and looks at the values in fields. Two objects with NULL inner values will be considered "equal" here.
      • write

        public byte[] write()
        Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
      • 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​(WitnessVersion 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`.