[TS] Test ChannelManager future notify completion
authorMatt Corallo <git@bluematt.me>
Thu, 6 Oct 2022 23:49:59 +0000 (23:49 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 6 Oct 2022 23:49:59 +0000 (23:49 +0000)
This is broken upstream in LDK, so needs fixing there.

ts/test/tests.mts

index a80f8a6b622d0748abe59616f6ae50cac8688f4f..ffd471ec734d10c0fe4accff347d5bc79ee9a007 100644 (file)
@@ -249,6 +249,13 @@ tests.push(async () => {
                }
        } as ldk.SocketDescriptorInterface);
 
+       const update_fut = a.chan_man.get_persistable_update_future();
+       var update_done = false;
+       update_fut.register_callback_fn(ldk.FutureCallback.new_impl({
+               call(): void { update_done = true; }
+       }));
+       if (update_done) return false;
+
        const v4_netaddr = ldk.NetAddress.constructor_ipv4(Uint8Array.from([42,0,42,1]), 9735);
        console.assert(pm_b.new_inbound_connection(sock_b, ldk.Option_NetAddressZ.constructor_some(v4_netaddr)) instanceof ldk.Result_NonePeerHandleErrorZ_OK);
        const init_bytes = pm_a.new_outbound_connection(b.node_id, sock_a, ldk.Option_NetAddressZ.constructor_none());
@@ -267,6 +274,7 @@ tests.push(async () => {
 
        const chan_create_res = a.chan_man.create_channel(b.node_id, BigInt(1000000), BigInt(400), BigInt(0), ldk.UserConfig.constructor_default());
        if (!chan_create_res.is_ok()) return false;
+       if (!update_done) return false;
 
        pm_a.process_events();
        pm_b.process_events();