X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FChannelCounterparty.java;h=afbf447817e34dfd10ecb6691fc9c060127269ea;hb=b9716bc7ee492882e4643c9365971fef3761989f;hp=535c6a0ae152e29490f475b863e823e827959615;hpb=ba1af51214a8ea2de62b84cd23b6145173c71752;p=ldk-java diff --git a/src/main/java/org/ldk/structs/ChannelCounterparty.java b/src/main/java/org/ldk/structs/ChannelCounterparty.java index 535c6a0a..afbf4478 100644 --- a/src/main/java/org/ldk/structs/ChannelCounterparty.java +++ b/src/main/java/org/ldk/structs/ChannelCounterparty.java @@ -85,6 +85,45 @@ public class ChannelCounterparty extends CommonBase { bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val); } + /** + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + @Nullable + public CounterpartyForwardingInfo get_forwarding_info() { + long ret = bindings.ChannelCounterparty_get_forwarding_info(this.ptr); + if (ret < 1024) { return null; } + CounterpartyForwardingInfo ret_hu_conv = new CounterpartyForwardingInfo(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + + /** + * Information on the fees and requirements that the counterparty requires when forwarding + * payments to us through this channel. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + public void set_forwarding_info(@Nullable CounterpartyForwardingInfo val) { + bindings.ChannelCounterparty_set_forwarding_info(this.ptr, val == null ? 0 : val.ptr & ~1); + this.ptrs_to.add(val); + } + + /** + * Constructs a new ChannelCounterparty given each field + */ + public static ChannelCounterparty of(byte[] node_id_arg, InitFeatures features_arg, long unspendable_punishment_reserve_arg, CounterpartyForwardingInfo forwarding_info_arg) { + long ret = bindings.ChannelCounterparty_new(node_id_arg, features_arg == null ? 0 : features_arg.ptr & ~1, unspendable_punishment_reserve_arg, forwarding_info_arg == null ? 0 : forwarding_info_arg.ptr & ~1); + if (ret < 1024) { return null; } + ChannelCounterparty ret_hu_conv = new ChannelCounterparty(null, ret); + ret_hu_conv.ptrs_to.add(ret_hu_conv); + ret_hu_conv.ptrs_to.add(features_arg); + ret_hu_conv.ptrs_to.add(forwarding_info_arg); + return ret_hu_conv; + } + /** * Creates a copy of the ChannelCounterparty */