X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FChannelAnnouncement.cs;h=1f8c8593fabee59ccce832494e883ef17d411607;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=e87ab57d405da5b1eaf9fd178e3e1e7fd55cc43f;hpb=8aa8a96fc6d8fcdd3fbb419b4b4c12482af14938;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/ChannelAnnouncement.cs b/c_sharp/src/org/ldk/structs/ChannelAnnouncement.cs index e87ab57d..1f8c8593 100644 --- a/c_sharp/src/org/ldk/structs/ChannelAnnouncement.cs +++ b/c_sharp/src/org/ldk/structs/ChannelAnnouncement.cs @@ -7,7 +7,9 @@ namespace org { namespace ldk { namespace structs { /** - * A channel_announcement message to be sent or received from a peer + * A [`channel_announcement`] message to be sent to or received from a peer. + * + * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message */ public class ChannelAnnouncement : CommonBase { internal ChannelAnnouncement(object _dummy, long ptr) : base(ptr) { } @@ -19,16 +21,18 @@ public class ChannelAnnouncement : CommonBase { * Authentication of the announcement by the first public node */ public byte[] get_node_signature_1() { - byte[] ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr); + long ret = bindings.ChannelAnnouncement_get_node_signature_1(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Authentication of the announcement by the first public node */ public void set_node_signature_1(byte[] val) { - bindings.ChannelAnnouncement_set_node_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64)); + bindings.ChannelAnnouncement_set_node_signature_1(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -37,16 +41,18 @@ public class ChannelAnnouncement : CommonBase { * Authentication of the announcement by the second public node */ public byte[] get_node_signature_2() { - byte[] ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr); + long ret = bindings.ChannelAnnouncement_get_node_signature_2(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Authentication of the announcement by the second public node */ public void set_node_signature_2(byte[] val) { - bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64)); + bindings.ChannelAnnouncement_set_node_signature_2(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -55,16 +61,18 @@ public class ChannelAnnouncement : CommonBase { * Proof of funding UTXO ownership by the first public node */ public byte[] get_bitcoin_signature_1() { - byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr); + long ret = bindings.ChannelAnnouncement_get_bitcoin_signature_1(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Proof of funding UTXO ownership by the first public node */ public void set_bitcoin_signature_1(byte[] val) { - bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, InternalUtils.check_arr_len(val, 64)); + bindings.ChannelAnnouncement_set_bitcoin_signature_1(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -73,16 +81,18 @@ public class ChannelAnnouncement : CommonBase { * Proof of funding UTXO ownership by the second public node */ public byte[] get_bitcoin_signature_2() { - byte[] ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr); + long ret = bindings.ChannelAnnouncement_get_bitcoin_signature_2(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Proof of funding UTXO ownership by the second public node */ public void set_bitcoin_signature_2(byte[] val) { - bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, InternalUtils.check_arr_len(val, 64)); + bindings.ChannelAnnouncement_set_bitcoin_signature_2(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64))); GC.KeepAlive(this); GC.KeepAlive(val); } @@ -113,7 +123,7 @@ public class ChannelAnnouncement : CommonBase { * Constructs a new ChannelAnnouncement given each field */ public static ChannelAnnouncement of(byte[] node_signature_1_arg, byte[] node_signature_2_arg, byte[] bitcoin_signature_1_arg, byte[] bitcoin_signature_2_arg, org.ldk.structs.UnsignedChannelAnnouncement contents_arg) { - long ret = bindings.ChannelAnnouncement_new(InternalUtils.check_arr_len(node_signature_1_arg, 64), InternalUtils.check_arr_len(node_signature_2_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_1_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_2_arg, 64), contents_arg == null ? 0 : contents_arg.ptr); + long ret = bindings.ChannelAnnouncement_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(node_signature_1_arg, 64)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(node_signature_2_arg, 64)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(bitcoin_signature_1_arg, 64)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(bitcoin_signature_2_arg, 64)), contents_arg == null ? 0 : contents_arg.ptr); GC.KeepAlive(node_signature_1_arg); GC.KeepAlive(node_signature_2_arg); GC.KeepAlive(bitcoin_signature_1_arg); @@ -165,16 +175,18 @@ public class ChannelAnnouncement : CommonBase { * Serialize the ChannelAnnouncement object into a byte array which can be read by ChannelAnnouncement_read */ public byte[] write() { - byte[] ret = bindings.ChannelAnnouncement_write(this.ptr); + long ret = bindings.ChannelAnnouncement_write(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Read a ChannelAnnouncement from a byte array, created by ChannelAnnouncement_write */ public static Result_ChannelAnnouncementDecodeErrorZ read(byte[] ser) { - long ret = bindings.ChannelAnnouncement_read(ser); + long ret = bindings.ChannelAnnouncement_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_ChannelAnnouncementDecodeErrorZ ret_hu_conv = Result_ChannelAnnouncementDecodeErrorZ.constr_from_ptr(ret);