X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBestBlock.cs;h=3d46e2b06aed97a4a1c025dc7c55539786e6acf8;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=60973ab9bd37700cd450894c8e1fe0b5a27aebcd;hpb=8aa8a96fc6d8fcdd3fbb419b4b4c12482af14938;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/BestBlock.cs b/c_sharp/src/org/ldk/structs/BestBlock.cs index 60973ab9..3d46e2b0 100644 --- a/c_sharp/src/org/ldk/structs/BestBlock.cs +++ b/c_sharp/src/org/ldk/structs/BestBlock.cs @@ -54,8 +54,8 @@ public class BestBlock : CommonBase { * Constructs a `BestBlock` that represents the genesis block at height 0 of the given * network. */ - public static BestBlock from_genesis(Network network) { - long ret = bindings.BestBlock_from_genesis(network); + public static BestBlock from_network(Network network) { + long ret = bindings.BestBlock_from_network(network); GC.KeepAlive(network); if (ret >= 0 && ret <= 4096) { return null; } org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BestBlock(null, ret); } @@ -67,7 +67,7 @@ public class BestBlock : CommonBase { * Returns a `BestBlock` as identified by the given block hash and height. */ public static BestBlock of(byte[] block_hash, int height) { - long ret = bindings.BestBlock_new(InternalUtils.check_arr_len(block_hash, 32), height); + long ret = bindings.BestBlock_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(block_hash, 32)), height); GC.KeepAlive(block_hash); GC.KeepAlive(height); if (ret >= 0 && ret <= 4096) { return null; } @@ -80,9 +80,11 @@ public class BestBlock : CommonBase { * Returns the best block hash. */ public byte[] block_hash() { - byte[] ret = bindings.BestBlock_block_hash(this.ptr); + long ret = bindings.BestBlock_block_hash(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /**