X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FEvent.cs;fp=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FEvent.cs;h=342adec38375d5de4389b7557f4760ef07cb72c4;hb=592c64eb658d92e314a2b983cea16cecf3882474;hp=ccc37c52d1e3ff02bfeb4458b7811e97dceddefc;hpb=12fdbefaac81d5b4be6bb67addd6dcd7c46a182b;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/Event.cs b/c_sharp/src/org/ldk/structs/Event.cs index ccc37c52..342adec3 100644 --- a/c_sharp/src/org/ldk/structs/Event.cs +++ b/c_sharp/src/org/ldk/structs/Event.cs @@ -56,7 +56,7 @@ public class Event : CommonBase { * * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated */ - public byte[] temporary_channel_id; + public ChannelId temporary_channel_id; /** * The counterparty's node_id, which you'll need to pass back into * [`ChannelManager::funding_transaction_generated`]. @@ -86,8 +86,9 @@ public class Event : CommonBase { public UInt128 user_channel_id; internal Event_FundingGenerationReady(long ptr) : base(null, ptr) { long temporary_channel_id = bindings.LDKEvent_FundingGenerationReady_get_temporary_channel_id(ptr); - byte[] temporary_channel_id_conv = InternalUtils.decodeUint8Array(temporary_channel_id); - this.temporary_channel_id = temporary_channel_id_conv; + org.ldk.structs.ChannelId temporary_channel_id_hu_conv = null; if (temporary_channel_id < 0 || temporary_channel_id > 4096) { temporary_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, temporary_channel_id); } + if (temporary_channel_id_hu_conv != null) { temporary_channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.temporary_channel_id = temporary_channel_id_hu_conv; long counterparty_node_id = bindings.LDKEvent_FundingGenerationReady_get_counterparty_node_id(ptr); byte[] counterparty_node_id_conv = InternalUtils.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; @@ -157,8 +158,10 @@ public class Event : CommonBase { public PaymentPurpose purpose; /** * The `channel_id` indicating over which channel we received the payment. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Option_ThirtyTwoBytesZ via_channel_id; + public ChannelId via_channel_id; /** * The `user_channel_id` indicating over which channel we received the payment. */ @@ -191,7 +194,7 @@ public class Event : CommonBase { if (purpose_hu_conv != null) { purpose_hu_conv.ptrs_to.AddLast(this); }; this.purpose = purpose_hu_conv; long via_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_channel_id(ptr); - org.ldk.structs.Option_ThirtyTwoBytesZ via_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(via_channel_id); + org.ldk.structs.ChannelId via_channel_id_hu_conv = null; if (via_channel_id < 0 || via_channel_id > 4096) { via_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, via_channel_id); } if (via_channel_id_hu_conv != null) { via_channel_id_hu_conv.ptrs_to.AddLast(this); }; this.via_channel_id = via_channel_id_hu_conv; long via_user_channel_id = bindings.LDKEvent_PaymentClaimable_get_via_user_channel_id(ptr); @@ -635,8 +638,10 @@ public class Event : CommonBase { * The `channel_id` indicating which channel the spendable outputs belong to. * * This will always be `Some` for events generated by LDK versions 0.0.117 and above. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Option_ThirtyTwoBytesZ channel_id; + public ChannelId channel_id; internal Event_SpendableOutputs(long ptr) : base(null, ptr) { long outputs = bindings.LDKEvent_SpendableOutputs_get_outputs(ptr); int outputs_conv_27_len = InternalUtils.getArrayLength(outputs); @@ -650,7 +655,7 @@ public class Event : CommonBase { bindings.free_buffer(outputs); this.outputs = outputs_conv_27_arr; long channel_id = bindings.LDKEvent_SpendableOutputs_get_channel_id(ptr); - org.ldk.structs.Option_ThirtyTwoBytesZ channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(channel_id); + org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); } if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.AddLast(this); }; this.channel_id = channel_id_hu_conv; } @@ -658,17 +663,37 @@ public class Event : CommonBase { /** A Event of type PaymentForwarded */ public class Event_PaymentForwarded : Event { /** - * The incoming channel between the previous node and us. This is only `None` for events - * generated or serialized by versions prior to 0.0.107. + * The channel id of the incoming channel between the previous node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.107. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public ChannelId prev_channel_id; + /** + * The channel id of the outgoing channel between the next node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.107. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public ChannelId next_channel_id; + /** + * The `user_channel_id` of the incoming channel between the previous node and us. + * + * This is only `None` for events generated or serialized by versions prior to 0.0.122. */ - public Option_ThirtyTwoBytesZ prev_channel_id; + public Option_U128Z prev_user_channel_id; /** - * The outgoing channel between the next node and us. This is only `None` for events - * generated or serialized by versions prior to 0.0.107. + * The `user_channel_id` of the outgoing channel between the next node and us. + * + * This will be `None` if the payment was settled via an on-chain transaction. See the + * caveat described for the `total_fee_earned_msat` field. Moreover it will be `None` for + * events generated or serialized by versions prior to 0.0.122. */ - public Option_ThirtyTwoBytesZ next_channel_id; + public Option_U128Z next_user_channel_id; /** - * The fee, in milli-satoshis, which was earned as a result of the payment. + * The total fee, in milli-satoshis, which was earned as a result of the payment. * * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC * was pending, the amount the next hop claimed will have been rounded down to the nearest @@ -679,10 +704,26 @@ public class Event : CommonBase { * If the channel which sent us the payment has been force-closed, we will claim the funds * via an on-chain transaction. In that case we do not yet know the on-chain transaction * fees which we will spend and will instead set this to `None`. It is possible duplicate - * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is + * `PaymentForwarded` events are generated for the same payment iff `total_fee_earned_msat` is * `None`. */ - public Option_u64Z fee_earned_msat; + public Option_u64Z total_fee_earned_msat; + /** + * The share of the total fee, in milli-satoshis, which was withheld in addition to the + * forwarding fee. + * + * This will only be `Some` if we forwarded an intercepted HTLC with less than the + * expected amount. This means our counterparty accepted to receive less than the invoice + * amount, e.g., by claiming the payment featuring a corresponding + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]. + * + * Will also always be `None` for events serialized with LDK prior to version 0.0.122. + * + * The caveat described above the `total_fee_earned_msat` field applies here as well. + * + * [`PaymentClaimable::counterparty_skimmed_fee_msat`]: Self::PaymentClaimable::counterparty_skimmed_fee_msat + */ + public Option_u64Z skimmed_fee_msat; /** * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain * transaction. @@ -691,22 +732,34 @@ public class Event : CommonBase { /** * The final amount forwarded, in milli-satoshis, after the fee is deducted. * - * The caveat described above the `fee_earned_msat` field applies here as well. + * The caveat described above the `total_fee_earned_msat` field applies here as well. */ public Option_u64Z outbound_amount_forwarded_msat; internal Event_PaymentForwarded(long ptr) : base(null, ptr) { long prev_channel_id = bindings.LDKEvent_PaymentForwarded_get_prev_channel_id(ptr); - org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(prev_channel_id); + org.ldk.structs.ChannelId prev_channel_id_hu_conv = null; if (prev_channel_id < 0 || prev_channel_id > 4096) { prev_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, prev_channel_id); } if (prev_channel_id_hu_conv != null) { prev_channel_id_hu_conv.ptrs_to.AddLast(this); }; this.prev_channel_id = prev_channel_id_hu_conv; long next_channel_id = bindings.LDKEvent_PaymentForwarded_get_next_channel_id(ptr); - org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(next_channel_id); + org.ldk.structs.ChannelId next_channel_id_hu_conv = null; if (next_channel_id < 0 || next_channel_id > 4096) { next_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, next_channel_id); } if (next_channel_id_hu_conv != null) { next_channel_id_hu_conv.ptrs_to.AddLast(this); }; this.next_channel_id = next_channel_id_hu_conv; - long fee_earned_msat = bindings.LDKEvent_PaymentForwarded_get_fee_earned_msat(ptr); - org.ldk.structs.Option_u64Z fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(fee_earned_msat); - if (fee_earned_msat_hu_conv != null) { fee_earned_msat_hu_conv.ptrs_to.AddLast(this); }; - this.fee_earned_msat = fee_earned_msat_hu_conv; + long prev_user_channel_id = bindings.LDKEvent_PaymentForwarded_get_prev_user_channel_id(ptr); + org.ldk.structs.Option_U128Z prev_user_channel_id_hu_conv = org.ldk.structs.Option_U128Z.constr_from_ptr(prev_user_channel_id); + if (prev_user_channel_id_hu_conv != null) { prev_user_channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.prev_user_channel_id = prev_user_channel_id_hu_conv; + long next_user_channel_id = bindings.LDKEvent_PaymentForwarded_get_next_user_channel_id(ptr); + org.ldk.structs.Option_U128Z next_user_channel_id_hu_conv = org.ldk.structs.Option_U128Z.constr_from_ptr(next_user_channel_id); + if (next_user_channel_id_hu_conv != null) { next_user_channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.next_user_channel_id = next_user_channel_id_hu_conv; + long total_fee_earned_msat = bindings.LDKEvent_PaymentForwarded_get_total_fee_earned_msat(ptr); + org.ldk.structs.Option_u64Z total_fee_earned_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(total_fee_earned_msat); + if (total_fee_earned_msat_hu_conv != null) { total_fee_earned_msat_hu_conv.ptrs_to.AddLast(this); }; + this.total_fee_earned_msat = total_fee_earned_msat_hu_conv; + long skimmed_fee_msat = bindings.LDKEvent_PaymentForwarded_get_skimmed_fee_msat(ptr); + org.ldk.structs.Option_u64Z skimmed_fee_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(skimmed_fee_msat); + if (skimmed_fee_msat_hu_conv != null) { skimmed_fee_msat_hu_conv.ptrs_to.AddLast(this); }; + this.skimmed_fee_msat = skimmed_fee_msat_hu_conv; this.claim_from_onchain_tx = bindings.LDKEvent_PaymentForwarded_get_claim_from_onchain_tx(ptr); long outbound_amount_forwarded_msat = bindings.LDKEvent_PaymentForwarded_get_outbound_amount_forwarded_msat(ptr); org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(outbound_amount_forwarded_msat); @@ -719,7 +772,7 @@ public class Event : CommonBase { /** * The `channel_id` of the channel that is pending confirmation. */ - public byte[] channel_id; + public ChannelId channel_id; /** * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if @@ -735,8 +788,10 @@ public class Event : CommonBase { * The `temporary_channel_id` this channel used to be known by during channel establishment. * * Will be `None` for channels created prior to LDK version 0.0.115. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - public Option_ThirtyTwoBytesZ former_temporary_channel_id; + public ChannelId former_temporary_channel_id; /** * The `node_id` of the channel counterparty. */ @@ -745,15 +800,24 @@ public class Event : CommonBase { * The outpoint of the channel's funding transaction. */ public OutPoint funding_txo; + /** + * The features that this channel will operate with. + * + * Will be `None` for channels created prior to LDK version 0.0.122. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public ChannelTypeFeatures channel_type; internal Event_ChannelPending(long ptr) : base(null, ptr) { long channel_id = bindings.LDKEvent_ChannelPending_get_channel_id(ptr); - byte[] channel_id_conv = InternalUtils.decodeUint8Array(channel_id); - this.channel_id = channel_id_conv; + org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); } + if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.channel_id = channel_id_hu_conv; long user_channel_id = bindings.LDKEvent_ChannelPending_get_user_channel_id(ptr); org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id); this.user_channel_id = user_channel_id_conv; long former_temporary_channel_id = bindings.LDKEvent_ChannelPending_get_former_temporary_channel_id(ptr); - org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id_hu_conv = org.ldk.structs.Option_ThirtyTwoBytesZ.constr_from_ptr(former_temporary_channel_id); + org.ldk.structs.ChannelId former_temporary_channel_id_hu_conv = null; if (former_temporary_channel_id < 0 || former_temporary_channel_id > 4096) { former_temporary_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, former_temporary_channel_id); } if (former_temporary_channel_id_hu_conv != null) { former_temporary_channel_id_hu_conv.ptrs_to.AddLast(this); }; this.former_temporary_channel_id = former_temporary_channel_id_hu_conv; long counterparty_node_id = bindings.LDKEvent_ChannelPending_get_counterparty_node_id(ptr); @@ -763,6 +827,10 @@ public class Event : CommonBase { org.ldk.structs.OutPoint funding_txo_hu_conv = null; if (funding_txo < 0 || funding_txo > 4096) { funding_txo_hu_conv = new org.ldk.structs.OutPoint(null, funding_txo); } if (funding_txo_hu_conv != null) { funding_txo_hu_conv.ptrs_to.AddLast(this); }; this.funding_txo = funding_txo_hu_conv; + long channel_type = bindings.LDKEvent_ChannelPending_get_channel_type(ptr); + org.ldk.structs.ChannelTypeFeatures channel_type_hu_conv = null; if (channel_type < 0 || channel_type > 4096) { channel_type_hu_conv = new org.ldk.structs.ChannelTypeFeatures(null, channel_type); } + if (channel_type_hu_conv != null) { channel_type_hu_conv.ptrs_to.AddLast(this); }; + this.channel_type = channel_type_hu_conv; } } /** A Event of type ChannelReady */ @@ -770,7 +838,7 @@ public class Event : CommonBase { /** * The `channel_id` of the channel that is ready. */ - public byte[] channel_id; + public ChannelId channel_id; /** * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if @@ -792,8 +860,9 @@ public class Event : CommonBase { public ChannelTypeFeatures channel_type; internal Event_ChannelReady(long ptr) : base(null, ptr) { long channel_id = bindings.LDKEvent_ChannelReady_get_channel_id(ptr); - byte[] channel_id_conv = InternalUtils.decodeUint8Array(channel_id); - this.channel_id = channel_id_conv; + org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); } + if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.channel_id = channel_id_hu_conv; long user_channel_id = bindings.LDKEvent_ChannelReady_get_user_channel_id(ptr); org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id); this.user_channel_id = user_channel_id_conv; @@ -812,7 +881,7 @@ public class Event : CommonBase { * The `channel_id` of the channel which has been closed. Note that on-chain transactions * resolving the channel are likely still awaiting confirmation. */ - public byte[] channel_id; + public ChannelId channel_id; /** * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if @@ -854,8 +923,9 @@ public class Event : CommonBase { public OutPoint channel_funding_txo; internal Event_ChannelClosed(long ptr) : base(null, ptr) { long channel_id = bindings.LDKEvent_ChannelClosed_get_channel_id(ptr); - byte[] channel_id_conv = InternalUtils.decodeUint8Array(channel_id); - this.channel_id = channel_id_conv; + org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); } + if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.channel_id = channel_id_hu_conv; long user_channel_id = bindings.LDKEvent_ChannelClosed_get_user_channel_id(ptr); org.ldk.util.UInt128 user_channel_id_conv = new org.ldk.util.UInt128(user_channel_id); this.user_channel_id = user_channel_id_conv; @@ -881,15 +951,16 @@ public class Event : CommonBase { /** * The channel_id of the channel which has been closed. */ - public byte[] channel_id; + public ChannelId channel_id; /** * The full transaction received from the user */ public byte[] transaction; internal Event_DiscardFunding(long ptr) : base(null, ptr) { long channel_id = bindings.LDKEvent_DiscardFunding_get_channel_id(ptr); - byte[] channel_id_conv = InternalUtils.decodeUint8Array(channel_id); - this.channel_id = channel_id_conv; + org.ldk.structs.ChannelId channel_id_hu_conv = null; if (channel_id < 0 || channel_id > 4096) { channel_id_hu_conv = new org.ldk.structs.ChannelId(null, channel_id); } + if (channel_id_hu_conv != null) { channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.channel_id = channel_id_hu_conv; long transaction = bindings.LDKEvent_DiscardFunding_get_transaction(ptr); byte[] transaction_conv = InternalUtils.decodeUint8Array(transaction); this.transaction = transaction_conv; @@ -907,7 +978,7 @@ public class Event : CommonBase { * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn */ - public byte[] temporary_channel_id; + public ChannelId temporary_channel_id; /** * The node_id of the counterparty requesting to open the channel. * @@ -948,8 +1019,9 @@ public class Event : CommonBase { public ChannelTypeFeatures channel_type; internal Event_OpenChannelRequest(long ptr) : base(null, ptr) { long temporary_channel_id = bindings.LDKEvent_OpenChannelRequest_get_temporary_channel_id(ptr); - byte[] temporary_channel_id_conv = InternalUtils.decodeUint8Array(temporary_channel_id); - this.temporary_channel_id = temporary_channel_id_conv; + org.ldk.structs.ChannelId temporary_channel_id_hu_conv = null; if (temporary_channel_id < 0 || temporary_channel_id > 4096) { temporary_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, temporary_channel_id); } + if (temporary_channel_id_hu_conv != null) { temporary_channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.temporary_channel_id = temporary_channel_id_hu_conv; long counterparty_node_id = bindings.LDKEvent_OpenChannelRequest_get_counterparty_node_id(ptr); byte[] counterparty_node_id_conv = InternalUtils.decodeUint8Array(counterparty_node_id); this.counterparty_node_id = counterparty_node_id_conv; @@ -966,15 +1038,16 @@ public class Event : CommonBase { /** * The channel over which the HTLC was received. */ - public byte[] prev_channel_id; + public ChannelId prev_channel_id; /** * Destination of the HTLC that failed to be processed. */ public HTLCDestination failed_next_destination; internal Event_HTLCHandlingFailed(long ptr) : base(null, ptr) { long prev_channel_id = bindings.LDKEvent_HTLCHandlingFailed_get_prev_channel_id(ptr); - byte[] prev_channel_id_conv = InternalUtils.decodeUint8Array(prev_channel_id); - this.prev_channel_id = prev_channel_id_conv; + org.ldk.structs.ChannelId prev_channel_id_hu_conv = null; if (prev_channel_id < 0 || prev_channel_id > 4096) { prev_channel_id_hu_conv = new org.ldk.structs.ChannelId(null, prev_channel_id); } + if (prev_channel_id_hu_conv != null) { prev_channel_id_hu_conv.ptrs_to.AddLast(this); }; + this.prev_channel_id = prev_channel_id_hu_conv; long failed_next_destination = bindings.LDKEvent_HTLCHandlingFailed_get_failed_next_destination(ptr); org.ldk.structs.HTLCDestination failed_next_destination_hu_conv = org.ldk.structs.HTLCDestination.constr_from_ptr(failed_next_destination); if (failed_next_destination_hu_conv != null) { failed_next_destination_hu_conv.ptrs_to.AddLast(this); }; @@ -1012,8 +1085,8 @@ public class Event : CommonBase { /** * Utility method to constructs a new FundingGenerationReady-variant Event */ - public static Event funding_generation_ready(byte[] temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) { - long ret = bindings.Event_funding_generation_ready(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(temporary_channel_id, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), channel_value_satoshis, InternalUtils.encodeUint8Array(output_script), InternalUtils.encodeUint8Array(user_channel_id.getLEBytes())); + public static Event funding_generation_ready(org.ldk.structs.ChannelId temporary_channel_id, byte[] counterparty_node_id, long channel_value_satoshis, byte[] output_script, org.ldk.util.UInt128 user_channel_id) { + long ret = bindings.Event_funding_generation_ready(temporary_channel_id.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), channel_value_satoshis, InternalUtils.encodeUint8Array(output_script), InternalUtils.encodeUint8Array(user_channel_id.getLEBytes())); GC.KeepAlive(temporary_channel_id); GC.KeepAlive(counterparty_node_id); GC.KeepAlive(channel_value_satoshis); @@ -1022,14 +1095,15 @@ public class Event : CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id); }; return ret_hu_conv; } /** * Utility method to constructs a new PaymentClaimable-variant Event */ - public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, org.ldk.structs.PaymentPurpose purpose, org.ldk.structs.Option_ThirtyTwoBytesZ via_channel_id, org.ldk.structs.Option_U128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) { - long ret = bindings.Event_payment_claimable(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(receiver_node_id, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), onion_fields == null ? 0 : onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, via_channel_id.ptr, via_user_channel_id.ptr, claim_deadline.ptr); + public static Event payment_claimable(byte[] receiver_node_id, byte[] payment_hash, org.ldk.structs.RecipientOnionFields onion_fields, long amount_msat, long counterparty_skimmed_fee_msat, org.ldk.structs.PaymentPurpose purpose, org.ldk.structs.ChannelId via_channel_id, org.ldk.structs.Option_U128Z via_user_channel_id, org.ldk.structs.Option_u32Z claim_deadline) { + long ret = bindings.Event_payment_claimable(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(receiver_node_id, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), onion_fields.ptr, amount_msat, counterparty_skimmed_fee_msat, purpose.ptr, via_channel_id.ptr, via_user_channel_id.ptr, claim_deadline.ptr); GC.KeepAlive(receiver_node_id); GC.KeepAlive(payment_hash); GC.KeepAlive(onion_fields); @@ -1054,7 +1128,7 @@ public class Event : CommonBase { * Utility method to constructs a new PaymentClaimed-variant Event */ public static Event payment_claimed(byte[] receiver_node_id, byte[] payment_hash, long amount_msat, org.ldk.structs.PaymentPurpose purpose, ClaimedHTLC[] htlcs, org.ldk.structs.Option_u64Z sender_intended_total_msat) { - long ret = bindings.Event_payment_claimed(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(receiver_node_id, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), amount_msat, purpose.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(htlcs, htlcs_conv_13 => htlcs_conv_13 == null ? 0 : htlcs_conv_13.ptr)), sender_intended_total_msat.ptr); + long ret = bindings.Event_payment_claimed(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(receiver_node_id, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), amount_msat, purpose.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(htlcs, htlcs_conv_13 => htlcs_conv_13.ptr)), sender_intended_total_msat.ptr); GC.KeepAlive(receiver_node_id); GC.KeepAlive(payment_hash); GC.KeepAlive(amount_msat); @@ -1132,7 +1206,7 @@ public class Event : CommonBase { * Utility method to constructs a new PaymentPathSuccessful-variant Event */ public static Event payment_path_successful(byte[] payment_id, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, org.ldk.structs.Path path) { - long ret = bindings.Event_payment_path_successful(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), payment_hash.ptr, path == null ? 0 : path.ptr); + long ret = bindings.Event_payment_path_successful(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), payment_hash.ptr, path.ptr); GC.KeepAlive(payment_id); GC.KeepAlive(payment_hash); GC.KeepAlive(path); @@ -1148,7 +1222,7 @@ public class Event : CommonBase { * Utility method to constructs a new PaymentPathFailed-variant Event */ public static Event payment_path_failed(org.ldk.structs.Option_ThirtyTwoBytesZ payment_id, byte[] payment_hash, bool payment_failed_permanently, org.ldk.structs.PathFailure failure, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) { - long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), payment_failed_permanently, failure.ptr, path == null ? 0 : path.ptr, short_channel_id.ptr); + long ret = bindings.Event_payment_path_failed(payment_id.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), payment_failed_permanently, failure.ptr, path.ptr, short_channel_id.ptr); GC.KeepAlive(payment_id); GC.KeepAlive(payment_hash); GC.KeepAlive(payment_failed_permanently); @@ -1169,7 +1243,7 @@ public class Event : CommonBase { * Utility method to constructs a new ProbeSuccessful-variant Event */ public static Event probe_successful(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path) { - long ret = bindings.Event_probe_successful(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), path == null ? 0 : path.ptr); + long ret = bindings.Event_probe_successful(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), path.ptr); GC.KeepAlive(payment_id); GC.KeepAlive(payment_hash); GC.KeepAlive(path); @@ -1184,7 +1258,7 @@ public class Event : CommonBase { * Utility method to constructs a new ProbeFailed-variant Event */ public static Event probe_failed(byte[] payment_id, byte[] payment_hash, org.ldk.structs.Path path, org.ldk.structs.Option_u64Z short_channel_id) { - long ret = bindings.Event_probe_failed(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), path == null ? 0 : path.ptr, short_channel_id.ptr); + long ret = bindings.Event_probe_failed(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), path.ptr, short_channel_id.ptr); GC.KeepAlive(payment_id); GC.KeepAlive(payment_hash); GC.KeepAlive(path); @@ -1228,7 +1302,7 @@ public class Event : CommonBase { /** * Utility method to constructs a new SpendableOutputs-variant Event */ - public static Event spendable_outputs(SpendableOutputDescriptor[] outputs, org.ldk.structs.Option_ThirtyTwoBytesZ channel_id) { + public static Event spendable_outputs(SpendableOutputDescriptor[] outputs, org.ldk.structs.ChannelId channel_id) { long ret = bindings.Event_spendable_outputs(InternalUtils.encodeUint64Array(InternalUtils.mapArray(outputs, outputs_conv_27 => outputs_conv_27.ptr)), channel_id.ptr); GC.KeepAlive(outputs); GC.KeepAlive(channel_id); @@ -1243,11 +1317,14 @@ public class Event : CommonBase { /** * Utility method to constructs a new PaymentForwarded-variant Event */ - public static Event payment_forwarded(org.ldk.structs.Option_ThirtyTwoBytesZ prev_channel_id, org.ldk.structs.Option_ThirtyTwoBytesZ next_channel_id, org.ldk.structs.Option_u64Z fee_earned_msat, bool claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) { - long ret = bindings.Event_payment_forwarded(prev_channel_id.ptr, next_channel_id.ptr, fee_earned_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr); + public static Event payment_forwarded(org.ldk.structs.ChannelId prev_channel_id, org.ldk.structs.ChannelId next_channel_id, org.ldk.structs.Option_U128Z prev_user_channel_id, org.ldk.structs.Option_U128Z next_user_channel_id, org.ldk.structs.Option_u64Z total_fee_earned_msat, org.ldk.structs.Option_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, org.ldk.structs.Option_u64Z outbound_amount_forwarded_msat) { + long ret = bindings.Event_payment_forwarded(prev_channel_id.ptr, next_channel_id.ptr, prev_user_channel_id.ptr, next_user_channel_id.ptr, total_fee_earned_msat.ptr, skimmed_fee_msat.ptr, claim_from_onchain_tx, outbound_amount_forwarded_msat.ptr); GC.KeepAlive(prev_channel_id); GC.KeepAlive(next_channel_id); - GC.KeepAlive(fee_earned_msat); + GC.KeepAlive(prev_user_channel_id); + GC.KeepAlive(next_user_channel_id); + GC.KeepAlive(total_fee_earned_msat); + GC.KeepAlive(skimmed_fee_msat); GC.KeepAlive(claim_from_onchain_tx); GC.KeepAlive(outbound_amount_forwarded_msat); if (ret >= 0 && ret <= 4096) { return null; } @@ -1255,7 +1332,10 @@ public class Event : CommonBase { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(prev_channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(next_channel_id); }; - if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(fee_earned_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(prev_user_channel_id); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(next_user_channel_id); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(total_fee_earned_msat); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(skimmed_fee_msat); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outbound_amount_forwarded_msat); }; return ret_hu_conv; } @@ -1263,26 +1343,29 @@ public class Event : CommonBase { /** * Utility method to constructs a new ChannelPending-variant Event */ - public static Event channel_pending(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.Option_ThirtyTwoBytesZ former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo) { - long ret = bindings.Event_channel_pending(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id, 32)), InternalUtils.encodeUint8Array(user_channel_id.getLEBytes()), former_temporary_channel_id.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), funding_txo == null ? 0 : funding_txo.ptr); + public static Event channel_pending(org.ldk.structs.ChannelId channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ChannelId former_temporary_channel_id, byte[] counterparty_node_id, org.ldk.structs.OutPoint funding_txo, org.ldk.structs.ChannelTypeFeatures channel_type) { + long ret = bindings.Event_channel_pending(channel_id.ptr, InternalUtils.encodeUint8Array(user_channel_id.getLEBytes()), former_temporary_channel_id.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), funding_txo.ptr, channel_type.ptr); GC.KeepAlive(channel_id); GC.KeepAlive(user_channel_id); GC.KeepAlive(former_temporary_channel_id); GC.KeepAlive(counterparty_node_id); GC.KeepAlive(funding_txo); + GC.KeepAlive(channel_type); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(former_temporary_channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_txo); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); }; return ret_hu_conv; } /** * Utility method to constructs a new ChannelReady-variant Event */ - public static Event channel_ready(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) { - long ret = bindings.Event_channel_ready(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id, 32)), InternalUtils.encodeUint8Array(user_channel_id.getLEBytes()), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), channel_type == null ? 0 : channel_type.ptr); + public static Event channel_ready(org.ldk.structs.ChannelId channel_id, org.ldk.util.UInt128 user_channel_id, byte[] counterparty_node_id, org.ldk.structs.ChannelTypeFeatures channel_type) { + long ret = bindings.Event_channel_ready(channel_id.ptr, InternalUtils.encodeUint8Array(user_channel_id.getLEBytes()), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), channel_type.ptr); GC.KeepAlive(channel_id); GC.KeepAlive(user_channel_id); GC.KeepAlive(counterparty_node_id); @@ -1290,6 +1373,7 @@ public class Event : CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); }; return ret_hu_conv; } @@ -1297,8 +1381,8 @@ public class Event : CommonBase { /** * Utility method to constructs a new ChannelClosed-variant Event */ - public static Event channel_closed(byte[] channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason, byte[] counterparty_node_id, org.ldk.structs.Option_u64Z channel_capacity_sats, org.ldk.structs.OutPoint channel_funding_txo) { - long ret = bindings.Event_channel_closed(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id, 32)), InternalUtils.encodeUint8Array(user_channel_id.getLEBytes()), reason.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), channel_capacity_sats.ptr, channel_funding_txo == null ? 0 : channel_funding_txo.ptr); + public static Event channel_closed(org.ldk.structs.ChannelId channel_id, org.ldk.util.UInt128 user_channel_id, org.ldk.structs.ClosureReason reason, byte[] counterparty_node_id, org.ldk.structs.Option_u64Z channel_capacity_sats, org.ldk.structs.OutPoint channel_funding_txo) { + long ret = bindings.Event_channel_closed(channel_id.ptr, InternalUtils.encodeUint8Array(user_channel_id.getLEBytes()), reason.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), channel_capacity_sats.ptr, channel_funding_txo.ptr); GC.KeepAlive(channel_id); GC.KeepAlive(user_channel_id); GC.KeepAlive(reason); @@ -1308,6 +1392,7 @@ public class Event : CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(reason); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_capacity_sats); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_funding_txo); }; @@ -1317,21 +1402,22 @@ public class Event : CommonBase { /** * Utility method to constructs a new DiscardFunding-variant Event */ - public static Event discard_funding(byte[] channel_id, byte[] transaction) { - long ret = bindings.Event_discard_funding(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id, 32)), InternalUtils.encodeUint8Array(transaction)); + public static Event discard_funding(org.ldk.structs.ChannelId channel_id, byte[] transaction) { + long ret = bindings.Event_discard_funding(channel_id.ptr, InternalUtils.encodeUint8Array(transaction)); GC.KeepAlive(channel_id); GC.KeepAlive(transaction); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id); }; return ret_hu_conv; } /** * Utility method to constructs a new OpenChannelRequest-variant Event */ - public static Event open_channel_request(byte[] temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) { - long ret = bindings.Event_open_channel_request(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(temporary_channel_id, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), funding_satoshis, push_msat, channel_type == null ? 0 : channel_type.ptr); + public static Event open_channel_request(org.ldk.structs.ChannelId temporary_channel_id, byte[] counterparty_node_id, long funding_satoshis, long push_msat, org.ldk.structs.ChannelTypeFeatures channel_type) { + long ret = bindings.Event_open_channel_request(temporary_channel_id.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(counterparty_node_id, 33)), funding_satoshis, push_msat, channel_type.ptr); GC.KeepAlive(temporary_channel_id); GC.KeepAlive(counterparty_node_id); GC.KeepAlive(funding_satoshis); @@ -1340,6 +1426,7 @@ public class Event : CommonBase { if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_type); }; return ret_hu_conv; } @@ -1347,13 +1434,14 @@ public class Event : CommonBase { /** * Utility method to constructs a new HTLCHandlingFailed-variant Event */ - public static Event htlchandling_failed(byte[] prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) { - long ret = bindings.Event_htlchandling_failed(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(prev_channel_id, 32)), failed_next_destination.ptr); + public static Event htlchandling_failed(org.ldk.structs.ChannelId prev_channel_id, org.ldk.structs.HTLCDestination failed_next_destination) { + long ret = bindings.Event_htlchandling_failed(prev_channel_id.ptr, failed_next_destination.ptr); GC.KeepAlive(prev_channel_id); GC.KeepAlive(failed_next_destination); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.Event ret_hu_conv = org.ldk.structs.Event.constr_from_ptr(ret); if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(prev_channel_id); }; if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(failed_next_destination); }; return ret_hu_conv; } @@ -1376,7 +1464,7 @@ public class Event : CommonBase { * This ignores pointers and is_owned flags and looks at the values in fields. */ public bool eq(org.ldk.structs.Event b) { - bool ret = bindings.Event_eq(this.ptr, b == null ? 0 : b.ptr); + bool ret = bindings.Event_eq(this.ptr, b.ptr); GC.KeepAlive(this); GC.KeepAlive(b); return ret;