X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FNetworkGraph.ts;h=4f33d5f8cf338efd22b81f5aa3d503d8c67e52bb;hb=0fee03a8095f5599f8eccd920c1b1af6b3a20260;hp=58e00cfeaa59c2e4af48d9f96ec7585a5d2cda81;hpb=a7653cf8717b1f9df4d3f4c4bd0b1f50f3bbc230;p=ldk-java diff --git a/ts/structs/NetworkGraph.ts b/ts/structs/NetworkGraph.ts index 58e00cfe..4f33d5f8 100644 --- a/ts/structs/NetworkGraph.ts +++ b/ts/structs/NetworkGraph.ts @@ -18,6 +18,18 @@ import * as bindings from '../bindings' // TODO: figure out location bindings.NetworkGraph_free(this.ptr); } } + public number clone_ptr() { + number ret = bindings.NetworkGraph_clone_ptr(this.ptr); + return ret; + } + + public NetworkGraph clone() { + number ret = bindings.NetworkGraph_clone(this.ptr); + const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; + } + public Uint8Array write() { Uint8Array ret = bindings.NetworkGraph_write(this.ptr); return ret; @@ -30,7 +42,7 @@ import * as bindings from '../bindings' // TODO: figure out location } public static NetworkGraph constructor_new(Uint8Array genesis_hash) { - number ret = bindings.NetworkGraph_new(genesis_hash); + number ret = bindings.NetworkGraph_new(InternalUtils.check_arr_len(genesis_hash, 32)); const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret); ret_hu_conv.ptrs_to.add(ret_hu_conv); return ret_hu_conv; @@ -61,6 +73,7 @@ import * as bindings from '../bindings' // TODO: figure out location number ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr); Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); + this.ptrs_to.add(chain_access); return ret_hu_conv; } @@ -68,6 +81,7 @@ import * as bindings from '../bindings' // TODO: figure out location number ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr); Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret); this.ptrs_to.add(msg); + this.ptrs_to.add(chain_access); return ret_hu_conv; } @@ -76,7 +90,11 @@ import * as bindings from '../bindings' // TODO: figure out location } public void fail_node(Uint8Array _node_id, boolean is_permanent) { - bindings.NetworkGraph_fail_node(this.ptr, _node_id, is_permanent); + bindings.NetworkGraph_fail_node(this.ptr, InternalUtils.check_arr_len(_node_id, 33), is_permanent); + } + + public void remove_stale_channels_with_time(number current_time_unix) { + bindings.NetworkGraph_remove_stale_channels_with_time(this.ptr, current_time_unix); } public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) {