X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FPing.cs;h=3bdad4c0b92914ebcfd1896fdeceeae6bbdff802;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=fb20d6171cc6da895f2f1a9fbb7254f6e0e14616;hpb=8aa8a96fc6d8fcdd3fbb419b4b4c12482af14938;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/Ping.cs b/c_sharp/src/org/ldk/structs/Ping.cs index fb20d617..3bdad4c0 100644 --- a/c_sharp/src/org/ldk/structs/Ping.cs +++ b/c_sharp/src/org/ldk/structs/Ping.cs @@ -7,7 +7,9 @@ namespace org { namespace ldk { namespace structs { /** - * A ping message to be sent or received from a peer + * A [`ping`] message to be sent to or received from a peer. + * + * [`ping`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-ping-and-pong-messages */ public class Ping : CommonBase { internal Ping(object _dummy, long ptr) : base(ptr) { } @@ -16,7 +18,7 @@ public class Ping : CommonBase { } /** - * The desired response length + * The desired response length. */ public short get_ponglen() { short ret = bindings.Ping_get_ponglen(this.ptr); @@ -25,7 +27,7 @@ public class Ping : CommonBase { } /** - * The desired response length + * The desired response length. */ public void set_ponglen(short val) { bindings.Ping_set_ponglen(this.ptr, val); @@ -35,6 +37,7 @@ public class Ping : CommonBase { /** * The ping packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ public short get_byteslen() { @@ -45,6 +48,7 @@ public class Ping : CommonBase { /** * The ping packet size. + * * This field is not sent on the wire. byteslen zeros are sent. */ public void set_byteslen(short val) { @@ -105,16 +109,18 @@ public class Ping : CommonBase { * Serialize the Ping object into a byte array which can be read by Ping_read */ public byte[] write() { - byte[] ret = bindings.Ping_write(this.ptr); + long ret = bindings.Ping_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 Ping from a byte array, created by Ping_write */ public static Result_PingDecodeErrorZ read(byte[] ser) { - long ret = bindings.Ping_read(ser); + long ret = bindings.Ping_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_PingDecodeErrorZ ret_hu_conv = Result_PingDecodeErrorZ.constr_from_ptr(ret);