1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Per-channel data used to build transactions in conjunction with the per-commitment data (CommitmentTransaction).
11 * The fields are organized by holder/counterparty.
13 * Normally, this is converted to the broadcaster/countersignatory-organized DirectedChannelTransactionParameters
14 * before use, via the as_holder_broadcastable and as_counterparty_broadcastable functions.
16 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
17 public class ChannelTransactionParameters extends CommonBase {
18 ChannelTransactionParameters(Object _dummy, long ptr) { super(ptr); }
19 @Override @SuppressWarnings("deprecation")
20 protected void finalize() throws Throwable {
22 if (ptr != 0) { bindings.ChannelTransactionParameters_free(ptr); }
28 public ChannelPublicKeys get_holder_pubkeys() {
29 long ret = bindings.ChannelTransactionParameters_get_holder_pubkeys(this.ptr);
30 ChannelPublicKeys ret_hu_conv = new ChannelPublicKeys(null, ret);
31 ret_hu_conv.ptrs_to.add(this);
38 public void set_holder_pubkeys(ChannelPublicKeys val) {
39 bindings.ChannelTransactionParameters_set_holder_pubkeys(this.ptr, val == null ? 0 : val.ptr & ~1);
40 this.ptrs_to.add(val);
44 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
46 public short get_holder_selected_contest_delay() {
47 short ret = bindings.ChannelTransactionParameters_get_holder_selected_contest_delay(this.ptr);
52 * The contest delay selected by the holder, which applies to counterparty-broadcast transactions
54 public void set_holder_selected_contest_delay(short val) {
55 bindings.ChannelTransactionParameters_set_holder_selected_contest_delay(this.ptr, val);
59 * Whether the holder is the initiator of this channel.
60 * This is an input to the commitment number obscure factor computation.
62 public boolean get_is_outbound_from_holder() {
63 boolean ret = bindings.ChannelTransactionParameters_get_is_outbound_from_holder(this.ptr);
68 * Whether the holder is the initiator of this channel.
69 * This is an input to the commitment number obscure factor computation.
71 public void set_is_outbound_from_holder(boolean val) {
72 bindings.ChannelTransactionParameters_set_is_outbound_from_holder(this.ptr, val);
76 * The late-bound counterparty channel transaction parameters.
77 * These parameters are populated at the point in the protocol where the counterparty provides them.
79 public CounterpartyChannelTransactionParameters get_counterparty_parameters() {
80 long ret = bindings.ChannelTransactionParameters_get_counterparty_parameters(this.ptr);
81 CounterpartyChannelTransactionParameters ret_hu_conv = new CounterpartyChannelTransactionParameters(null, ret);
82 ret_hu_conv.ptrs_to.add(this);
87 * The late-bound counterparty channel transaction parameters.
88 * These parameters are populated at the point in the protocol where the counterparty provides them.
90 public void set_counterparty_parameters(CounterpartyChannelTransactionParameters val) {
91 bindings.ChannelTransactionParameters_set_counterparty_parameters(this.ptr, val == null ? 0 : val.ptr & ~1);
92 this.ptrs_to.add(val);
96 * The late-bound funding outpoint
98 public OutPoint get_funding_outpoint() {
99 long ret = bindings.ChannelTransactionParameters_get_funding_outpoint(this.ptr);
100 OutPoint ret_hu_conv = new OutPoint(null, ret);
101 ret_hu_conv.ptrs_to.add(this);
106 * The late-bound funding outpoint
108 public void set_funding_outpoint(OutPoint val) {
109 bindings.ChannelTransactionParameters_set_funding_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
110 this.ptrs_to.add(val);
114 * Constructs a new ChannelTransactionParameters given each field
116 public static ChannelTransactionParameters of(ChannelPublicKeys holder_pubkeys_arg, short holder_selected_contest_delay_arg, boolean is_outbound_from_holder_arg, CounterpartyChannelTransactionParameters counterparty_parameters_arg, OutPoint funding_outpoint_arg) {
117 long ret = bindings.ChannelTransactionParameters_new(holder_pubkeys_arg == null ? 0 : holder_pubkeys_arg.ptr & ~1, holder_selected_contest_delay_arg, is_outbound_from_holder_arg, counterparty_parameters_arg == null ? 0 : counterparty_parameters_arg.ptr & ~1, funding_outpoint_arg == null ? 0 : funding_outpoint_arg.ptr & ~1);
118 ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret);
119 ret_hu_conv.ptrs_to.add(ret_hu_conv);
120 ret_hu_conv.ptrs_to.add(holder_pubkeys_arg);
121 ret_hu_conv.ptrs_to.add(counterparty_parameters_arg);
122 ret_hu_conv.ptrs_to.add(funding_outpoint_arg);
127 * Creates a copy of the ChannelTransactionParameters
129 public ChannelTransactionParameters clone() {
130 long ret = bindings.ChannelTransactionParameters_clone(this.ptr);
131 ChannelTransactionParameters ret_hu_conv = new ChannelTransactionParameters(null, ret);
132 ret_hu_conv.ptrs_to.add(this);
137 * Whether the late bound parameters are populated.
139 public boolean is_populated() {
140 boolean ret = bindings.ChannelTransactionParameters_is_populated(this.ptr);
145 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
146 * given that the holder is the broadcaster.
148 * self.is_populated() must be true before calling this function.
150 public DirectedChannelTransactionParameters as_holder_broadcastable() {
151 long ret = bindings.ChannelTransactionParameters_as_holder_broadcastable(this.ptr);
152 DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret);
153 ret_hu_conv.ptrs_to.add(this);
158 * Convert the holder/counterparty parameters to broadcaster/countersignatory-organized parameters,
159 * given that the counterparty is the broadcaster.
161 * self.is_populated() must be true before calling this function.
163 public DirectedChannelTransactionParameters as_counterparty_broadcastable() {
164 long ret = bindings.ChannelTransactionParameters_as_counterparty_broadcastable(this.ptr);
165 DirectedChannelTransactionParameters ret_hu_conv = new DirectedChannelTransactionParameters(null, ret);
166 ret_hu_conv.ptrs_to.add(this);
171 * Serialize the ChannelTransactionParameters object into a byte array which can be read by ChannelTransactionParameters_read
173 public byte[] write() {
174 byte[] ret = bindings.ChannelTransactionParameters_write(this.ptr);
179 * Read a ChannelTransactionParameters from a byte array, created by ChannelTransactionParameters_write
181 public static Result_ChannelTransactionParametersDecodeErrorZ read(byte[] ser) {
182 long ret = bindings.ChannelTransactionParameters_read(ser);
183 Result_ChannelTransactionParametersDecodeErrorZ ret_hu_conv = Result_ChannelTransactionParametersDecodeErrorZ.constr_from_ptr(ret);