1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
12 * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
13 * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
14 * the return value of [`Filter::register_output`].
16 * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
17 * may have been spent there. See [`Filter::register_output`] for details.
19 * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
20 * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
22 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
23 public class WatchedOutput extends CommonBase {
24 WatchedOutput(Object _dummy, long ptr) { super(ptr); }
25 @Override @SuppressWarnings("deprecation")
26 protected void finalize() throws Throwable {
28 if (ptr != 0) { bindings.WatchedOutput_free(ptr); }
32 * First block where the transaction output may have been spent.
34 public byte[] get_block_hash() {
35 byte[] ret = bindings.WatchedOutput_get_block_hash(this.ptr);
40 * First block where the transaction output may have been spent.
42 public void set_block_hash(byte[] val) {
43 bindings.WatchedOutput_set_block_hash(this.ptr, val);
47 * Outpoint identifying the transaction output.
49 public OutPoint get_outpoint() {
50 long ret = bindings.WatchedOutput_get_outpoint(this.ptr);
51 OutPoint ret_hu_conv = new OutPoint(null, ret);
52 ret_hu_conv.ptrs_to.add(this);
57 * Outpoint identifying the transaction output.
59 public void set_outpoint(OutPoint val) {
60 bindings.WatchedOutput_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
61 this.ptrs_to.add(val);
65 * Spending condition of the transaction output.
67 public byte[] get_script_pubkey() {
68 byte[] ret = bindings.WatchedOutput_get_script_pubkey(this.ptr);
73 * Spending condition of the transaction output.
75 public void set_script_pubkey(byte[] val) {
76 bindings.WatchedOutput_set_script_pubkey(this.ptr, val);
80 * Constructs a new WatchedOutput given each field
82 public static WatchedOutput constructor_new(byte[] block_hash_arg, OutPoint outpoint_arg, byte[] script_pubkey_arg) {
83 long ret = bindings.WatchedOutput_new(block_hash_arg, outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, script_pubkey_arg);
84 WatchedOutput ret_hu_conv = new WatchedOutput(null, ret);
85 ret_hu_conv.ptrs_to.add(ret_hu_conv);
86 ret_hu_conv.ptrs_to.add(outpoint_arg);