6 namespace org { namespace ldk { namespace structs {
9 * Represents the different types of transactions, originating from LDK, to be bumped.
11 public class BumpTransactionEvent : CommonBase {
12 protected BumpTransactionEvent(object _dummy, long ptr) : base(ptr) { }
13 ~BumpTransactionEvent() {
14 if (ptr != 0) { bindings.BumpTransactionEvent_free(ptr); }
17 internal static BumpTransactionEvent constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKBumpTransactionEvent_ty_from_ptr(ptr);
20 case 0: return new BumpTransactionEvent_ChannelClose(ptr);
21 case 1: return new BumpTransactionEvent_HTLCResolution(ptr);
23 throw new ArgumentException("Impossible enum variant");
27 /** A BumpTransactionEvent of type ChannelClose */
28 public class BumpTransactionEvent_ChannelClose : BumpTransactionEvent {
30 * The unique identifier for the claim of the anchor output in the commitment transaction.
32 * The identifier must map to the set of external UTXOs assigned to the claim, such that
33 * they can be reused when a new claim with the same identifier needs to be made, resulting
34 * in a fee-bumping attempt.
36 public byte[] claim_id;
38 * The target feerate that the transaction package, which consists of the commitment
39 * transaction and the to-be-crafted child anchor transaction, must meet.
41 public int package_target_feerate_sat_per_1000_weight;
43 * The channel's commitment transaction to bump the fee of. This transaction should be
44 * broadcast along with the anchor transaction constructed as a result of consuming this
47 public byte[] commitment_tx;
49 * The absolute fee in satoshis of the commitment transaction. This can be used along the
50 * with weight of the commitment transaction to determine its feerate.
52 public long commitment_tx_fee_satoshis;
54 * The descriptor to sign the anchor input of the anchor transaction constructed as a
55 * result of consuming this event.
57 public AnchorDescriptor anchor_descriptor;
59 * The set of pending HTLCs on the commitment transaction that need to be resolved once the
60 * commitment transaction confirms.
62 public HTLCOutputInCommitment[] pending_htlcs;
63 internal BumpTransactionEvent_ChannelClose(long ptr) : base(null, ptr) {
64 this.claim_id = bindings.LDKBumpTransactionEvent_ChannelClose_get_claim_id(ptr);
65 this.package_target_feerate_sat_per_1000_weight = bindings.LDKBumpTransactionEvent_ChannelClose_get_package_target_feerate_sat_per_1000_weight(ptr);
66 this.commitment_tx = bindings.LDKBumpTransactionEvent_ChannelClose_get_commitment_tx(ptr);
67 this.commitment_tx_fee_satoshis = bindings.LDKBumpTransactionEvent_ChannelClose_get_commitment_tx_fee_satoshis(ptr);
68 long anchor_descriptor = bindings.LDKBumpTransactionEvent_ChannelClose_get_anchor_descriptor(ptr);
69 org.ldk.structs.AnchorDescriptor anchor_descriptor_hu_conv = null; if (anchor_descriptor < 0 || anchor_descriptor > 4096) { anchor_descriptor_hu_conv = new org.ldk.structs.AnchorDescriptor(null, anchor_descriptor); }
70 if (anchor_descriptor_hu_conv != null) { anchor_descriptor_hu_conv.ptrs_to.AddLast(this); };
71 this.anchor_descriptor = anchor_descriptor_hu_conv;
72 long[] pending_htlcs = bindings.LDKBumpTransactionEvent_ChannelClose_get_pending_htlcs(ptr);
73 int pending_htlcs_conv_24_len = pending_htlcs.Length;
74 HTLCOutputInCommitment[] pending_htlcs_conv_24_arr = new HTLCOutputInCommitment[pending_htlcs_conv_24_len];
75 for (int y = 0; y < pending_htlcs_conv_24_len; y++) {
76 long pending_htlcs_conv_24 = pending_htlcs[y];
77 org.ldk.structs.HTLCOutputInCommitment pending_htlcs_conv_24_hu_conv = null; if (pending_htlcs_conv_24 < 0 || pending_htlcs_conv_24 > 4096) { pending_htlcs_conv_24_hu_conv = new org.ldk.structs.HTLCOutputInCommitment(null, pending_htlcs_conv_24); }
78 if (pending_htlcs_conv_24_hu_conv != null) { pending_htlcs_conv_24_hu_conv.ptrs_to.AddLast(this); };
79 pending_htlcs_conv_24_arr[y] = pending_htlcs_conv_24_hu_conv;
81 this.pending_htlcs = pending_htlcs_conv_24_arr;
84 /** A BumpTransactionEvent of type HTLCResolution */
85 public class BumpTransactionEvent_HTLCResolution : BumpTransactionEvent {
87 * The unique identifier for the claim of the HTLCs in the confirmed commitment
90 * The identifier must map to the set of external UTXOs assigned to the claim, such that
91 * they can be reused when a new claim with the same identifier needs to be made, resulting
92 * in a fee-bumping attempt.
94 public byte[] claim_id;
96 * The target feerate that the resulting HTLC transaction must meet.
98 public int target_feerate_sat_per_1000_weight;
100 * The set of pending HTLCs on the confirmed commitment that need to be claimed, preferably
101 * by the same transaction.
103 public HTLCDescriptor[] htlc_descriptors;
105 * The locktime required for the resulting HTLC transaction.
107 public int tx_lock_time;
108 internal BumpTransactionEvent_HTLCResolution(long ptr) : base(null, ptr) {
109 this.claim_id = bindings.LDKBumpTransactionEvent_HTLCResolution_get_claim_id(ptr);
110 this.target_feerate_sat_per_1000_weight = bindings.LDKBumpTransactionEvent_HTLCResolution_get_target_feerate_sat_per_1000_weight(ptr);
111 long[] htlc_descriptors = bindings.LDKBumpTransactionEvent_HTLCResolution_get_htlc_descriptors(ptr);
112 int htlc_descriptors_conv_16_len = htlc_descriptors.Length;
113 HTLCDescriptor[] htlc_descriptors_conv_16_arr = new HTLCDescriptor[htlc_descriptors_conv_16_len];
114 for (int q = 0; q < htlc_descriptors_conv_16_len; q++) {
115 long htlc_descriptors_conv_16 = htlc_descriptors[q];
116 org.ldk.structs.HTLCDescriptor htlc_descriptors_conv_16_hu_conv = null; if (htlc_descriptors_conv_16 < 0 || htlc_descriptors_conv_16 > 4096) { htlc_descriptors_conv_16_hu_conv = new org.ldk.structs.HTLCDescriptor(null, htlc_descriptors_conv_16); }
117 if (htlc_descriptors_conv_16_hu_conv != null) { htlc_descriptors_conv_16_hu_conv.ptrs_to.AddLast(this); };
118 htlc_descriptors_conv_16_arr[q] = htlc_descriptors_conv_16_hu_conv;
120 this.htlc_descriptors = htlc_descriptors_conv_16_arr;
121 this.tx_lock_time = bindings.LDKBumpTransactionEvent_HTLCResolution_get_tx_lock_time(ptr);
124 internal long clone_ptr() {
125 long ret = bindings.BumpTransactionEvent_clone_ptr(this.ptr);
131 * Creates a copy of the BumpTransactionEvent
133 public BumpTransactionEvent clone() {
134 long ret = bindings.BumpTransactionEvent_clone(this.ptr);
136 if (ret >= 0 && ret <= 4096) { return null; }
137 org.ldk.structs.BumpTransactionEvent ret_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(ret);
138 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
143 * Utility method to constructs a new ChannelClose-variant BumpTransactionEvent
145 public static BumpTransactionEvent channel_close(byte[] claim_id, int package_target_feerate_sat_per_1000_weight, byte[] commitment_tx, long commitment_tx_fee_satoshis, org.ldk.structs.AnchorDescriptor anchor_descriptor, HTLCOutputInCommitment[] pending_htlcs) {
146 long ret = bindings.BumpTransactionEvent_channel_close(InternalUtils.check_arr_len(claim_id, 32), package_target_feerate_sat_per_1000_weight, commitment_tx, commitment_tx_fee_satoshis, anchor_descriptor == null ? 0 : anchor_descriptor.ptr, pending_htlcs != null ? InternalUtils.mapArray(pending_htlcs, pending_htlcs_conv_24 => pending_htlcs_conv_24 == null ? 0 : pending_htlcs_conv_24.ptr) : null);
147 GC.KeepAlive(claim_id);
148 GC.KeepAlive(package_target_feerate_sat_per_1000_weight);
149 GC.KeepAlive(commitment_tx);
150 GC.KeepAlive(commitment_tx_fee_satoshis);
151 GC.KeepAlive(anchor_descriptor);
152 GC.KeepAlive(pending_htlcs);
153 if (ret >= 0 && ret <= 4096) { return null; }
154 org.ldk.structs.BumpTransactionEvent ret_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(ret);
155 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(anchor_descriptor); };
157 foreach (HTLCOutputInCommitment pending_htlcs_conv_24 in pending_htlcs) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(pending_htlcs_conv_24); }; };
162 * Utility method to constructs a new HTLCResolution-variant BumpTransactionEvent
164 public static BumpTransactionEvent htlcresolution(byte[] claim_id, int target_feerate_sat_per_1000_weight, HTLCDescriptor[] htlc_descriptors, int tx_lock_time) {
165 long ret = bindings.BumpTransactionEvent_htlcresolution(InternalUtils.check_arr_len(claim_id, 32), target_feerate_sat_per_1000_weight, htlc_descriptors != null ? InternalUtils.mapArray(htlc_descriptors, htlc_descriptors_conv_16 => htlc_descriptors_conv_16 == null ? 0 : htlc_descriptors_conv_16.ptr) : null, tx_lock_time);
166 GC.KeepAlive(claim_id);
167 GC.KeepAlive(target_feerate_sat_per_1000_weight);
168 GC.KeepAlive(htlc_descriptors);
169 GC.KeepAlive(tx_lock_time);
170 if (ret >= 0 && ret <= 4096) { return null; }
171 org.ldk.structs.BumpTransactionEvent ret_hu_conv = org.ldk.structs.BumpTransactionEvent.constr_from_ptr(ret);
172 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
173 foreach (HTLCDescriptor htlc_descriptors_conv_16 in htlc_descriptors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_descriptors_conv_16); }; };
178 * Checks if two BumpTransactionEvents contain equal inner contents.
179 * This ignores pointers and is_owned flags and looks at the values in fields.
181 public bool eq(org.ldk.structs.BumpTransactionEvent b) {
182 bool ret = bindings.BumpTransactionEvent_eq(this.ptr, b == null ? 0 : b.ptr);
188 public override bool Equals(object o) {
189 if (!(o is BumpTransactionEvent)) return false;
190 return this.eq((BumpTransactionEvent)o);