]> git.bitcoin.ninja Git - ldk-java/commitdiff
[TypeScript] Update tests to LDK 0.1 API
authorMatt Corallo <git@bluematt.me>
Sun, 12 Jan 2025 21:12:55 +0000 (21:12 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 17 Jan 2025 20:40:45 +0000 (20:40 +0000)
ts/test/tests.mts

index 243ced47d910b5b50e809baef435414e5c656313..7e0c9fda9d367390a8e826a124a17f592b9a0a32 100644 (file)
@@ -110,12 +110,13 @@ function get_chanman(): Node {
        const scorer = ldk.ProbabilisticScorer.constructor_new(ldk.ProbabilisticScoringDecayParameters.constructor_default(), net_graph, logger);
        const lockable_score = ldk.MultiThreadedLockableScore.constructor_new(scorer.as_Score());
        const router = ldk.DefaultRouter.constructor_new(net_graph, logger, keys_manager.as_EntropySource(), lockable_score.as_LockableScore(), ldk.ProbabilisticScoringFeeParameters.constructor_default());
+       const msg_router = ldk.DefaultMessageRouter.constructor_new(net_graph, keys_manager.as_EntropySource());
 
        const config = ldk.UserConfig.constructor_default();
        const params = ldk.ChainParameters.constructor_new(ldk.Network.LDKNetwork_Testnet, ldk.BestBlock.constructor_from_network(ldk.Network.LDKNetwork_Testnet));
        const chan_man = ldk.ChannelManager.constructor_new(fee_est, chain_watch, tx_broadcaster!, router.as_Router(),
-               logger, keys_manager.as_EntropySource(), keys_manager.as_NodeSigner(), keys_manager.as_SignerProvider(),
-               config, params, 42);
+               msg_router.as_MessageRouter(), logger, keys_manager.as_EntropySource(), keys_manager.as_NodeSigner(),
+               keys_manager.as_SignerProvider(), config, params, 42);
        return new Node(chan_man, tx_broadcasted, logger, keys_manager, net_graph);
 }
 
@@ -341,7 +342,8 @@ tests.push(async () => {
        const underlying_om_a = ldk.OnionMessenger.constructor_new(
                a.keys_manager.as_EntropySource(), a.keys_manager.as_NodeSigner(), a.logger,
                a.chan_man.as_NodeIdLookUp(), a_msg_router, ignorer.as_OffersMessageHandler(),
-               ignorer.as_AsyncPaymentsMessageHandler(), om_handler_a);
+               ignorer.as_AsyncPaymentsMessageHandler(), a.chan_man.as_DNSResolverMessageHandler(),
+               om_handler_a);
        const om_a = ldk.OnionMessageHandler.new_impl({
                handle_onion_message(peer_node_id: Uint8Array, msg: ldk.OnionMessage) {
                        underlying_om_a.as_OnionMessageHandler().handle_onion_message(peer_node_id, msg);
@@ -388,7 +390,8 @@ tests.push(async () => {
                .constructor_new(b.net_graph, b.keys_manager.as_EntropySource()).as_MessageRouter();
        const om_b = ldk.OnionMessenger.constructor_new(b.keys_manager.as_EntropySource(),
                b.keys_manager.as_NodeSigner(), b.logger, b.chan_man.as_NodeIdLookUp(), msg_router_b,
-               ignorer.as_OffersMessageHandler(), ignorer.as_AsyncPaymentsMessageHandler(), om_handler_b);
+               ignorer.as_OffersMessageHandler(), ignorer.as_AsyncPaymentsMessageHandler(),
+               b.chan_man.as_DNSResolverMessageHandler(), om_handler_b);
 
        const pm_a = ldk.PeerManager.constructor_new(a.chan_man.as_ChannelMessageHandler(), ignorer.as_RoutingMessageHandler(),
                om_a, ignorer.as_CustomMessageHandler(), 0xdeadbeef,