Package org.ldk.structs
Class ShutdownScript
- java.lang.Object
-
- org.ldk.structs.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
as_legacy_pubkey()
Returns the [`PublicKey`] used for a P2WPKH shutdown script if constructed directly from it.ShutdownScript
clone()
Creates a copy of the ShutdownScriptprotected void
finalize()
byte[]
into_inner()
Converts the shutdown script into the underlying [`Script`].boolean
is_compatible(InitFeatures features)
Returns whether the shutdown script is compatible with the features as defined by BOLT #2.static ShutdownScript
new_p2pkh(byte[] pubkey_hash)
Generates a P2PKH script pubkey from the given [`PubkeyHash`].static ShutdownScript
new_p2sh(byte[] script_hash)
Generates a P2SH script pubkey from the given [`ScriptHash`].static ShutdownScript
new_p2wpkh(byte[] pubkey_hash)
Generates a P2WPKH script pubkey from the given [`WPubkeyHash`].static ShutdownScript
new_p2wsh(byte[] script_hash)
Generates a P2WSH script pubkey from the given [`WScriptHash`].static Result_ShutdownScriptInvalidShutdownScriptZ
new_witness_program(byte version, byte[] program)
Generates a witness script pubkey from the given segwit version and program.static Result_ShutdownScriptDecodeErrorZ
read(byte[] ser)
Read a ShutdownScript from a byte array, created by ShutdownScript_writebyte[]
write()
Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
clone
public ShutdownScript clone()
Creates a copy of the ShutdownScript
-
write
public byte[] write()
Serialize the ShutdownScript object into a byte array which can be read by ShutdownScript_read
-
read
public static Result_ShutdownScriptDecodeErrorZ read(byte[] ser)
Read a ShutdownScript from a byte array, created by ShutdownScript_write
-
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`.
-
-