projects
/
ldk-java
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #117 from TheBlueMatt/2022-08-fix-npe
[ldk-java]
/
src
/
main
/
java
/
org
/
ldk
/
structs
/
BestBlock.java
diff --git
a/src/main/java/org/ldk/structs/BestBlock.java
b/src/main/java/org/ldk/structs/BestBlock.java
index 9d3629ebe4c016a63fe31e4eff59802e69ef6118..fd0e09c11c943c8c68a8ebc2b6bd4b418cf44397 100644
(file)
--- a/
src/main/java/org/ldk/structs/BestBlock.java
+++ b/
src/main/java/org/ldk/structs/BestBlock.java
@@
-4,6
+4,7
@@
import org.ldk.impl.bindings;
import org.ldk.enums.*;
import org.ldk.util.*;
import java.util.Arrays;
import org.ldk.enums.*;
import org.ldk.util.*;
import java.util.Arrays;
+import java.lang.ref.Reference;
import javax.annotation.Nullable;
import javax.annotation.Nullable;
@@
-19,14
+20,21
@@
public class BestBlock extends CommonBase {
if (ptr != 0) { bindings.BestBlock_free(ptr); }
}
if (ptr != 0) { bindings.BestBlock_free(ptr); }
}
+ long clone_ptr() {
+ long ret = bindings.BestBlock_clone_ptr(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
/**
* Creates a copy of the BestBlock
*/
public BestBlock clone() {
long ret = bindings.BestBlock_clone(this.ptr);
/**
* Creates a copy of the BestBlock
*/
public BestBlock clone() {
long ret = bindings.BestBlock_clone(this.ptr);
+ Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
if (ret >= 0 && ret <= 4096) { return null; }
-
BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new
BestBlock(null, ret); }
-
ret_hu_conv.ptrs_to.add(this)
;
+
org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.
BestBlock(null, ret); }
+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); }
;
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-36,9
+44,10
@@
public class BestBlock extends CommonBase {
*/
public static BestBlock from_genesis(org.ldk.enums.Network network) {
long ret = bindings.BestBlock_from_genesis(network);
*/
public static BestBlock from_genesis(org.ldk.enums.Network network) {
long ret = bindings.BestBlock_from_genesis(network);
+ Reference.reachabilityFence(network);
if (ret >= 0 && ret <= 4096) { return null; }
if (ret >= 0 && ret <= 4096) { return null; }
-
BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new
BestBlock(null, ret); }
-
ret_hu_conv.ptrs_to.add(ret_hu_conv)
;
+
org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.
BestBlock(null, ret); }
+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }
;
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-46,10
+55,12
@@
public class BestBlock extends CommonBase {
* Returns a `BestBlock` as identified by the given block hash and height.
*/
public static BestBlock of(byte[] block_hash, int height) {
* 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(block_hash, height);
+ long ret = bindings.BestBlock_new(InternalUtils.check_arr_len(block_hash, 32), height);
+ Reference.reachabilityFence(block_hash);
+ Reference.reachabilityFence(height);
if (ret >= 0 && ret <= 4096) { return null; }
if (ret >= 0 && ret <= 4096) { return null; }
-
BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new
BestBlock(null, ret); }
-
ret_hu_conv.ptrs_to.add(ret_hu_conv)
;
+
org.ldk.structs.BestBlock ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.
BestBlock(null, ret); }
+
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); }
;
return ret_hu_conv;
}
return ret_hu_conv;
}
@@
-58,6
+69,7
@@
public class BestBlock extends CommonBase {
*/
public byte[] block_hash() {
byte[] ret = bindings.BestBlock_block_hash(this.ptr);
*/
public byte[] block_hash() {
byte[] ret = bindings.BestBlock_block_hash(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}
return ret;
}
@@
-66,6
+78,7
@@
public class BestBlock extends CommonBase {
*/
public int height() {
int ret = bindings.BestBlock_height(this.ptr);
*/
public int height() {
int ret = bindings.BestBlock_height(this.ptr);
+ Reference.reachabilityFence(this);
return ret;
}
return ret;
}