]> git.bitcoin.ninja Git - ldk-java/commitdiff
Update tests to upstream 0.0.102 API
authorMatt Corallo <git@bluematt.me>
Sun, 17 Oct 2021 01:22:34 +0000 (01:22 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 17 Oct 2021 01:22:34 +0000 (01:22 +0000)
src/test/java/org/ldk/HumanObjectPeerTest.java
src/test/java/org/ldk/PeerTest.java

index e98632e24ea14e559959431965b6e45d813c2b3e..261902b7f059197387feae6e9b6b78fbfdcac770 100644 (file)
@@ -659,8 +659,8 @@ class HumanObjectPeerTestInstance {
 
         connect_peers(peer1, peer2);
 
-        Result_NoneAPIErrorZ cc_res = peer1.chan_manager.create_channel(peer2.node_id, 100000, 1000, 42, null);
-        assert cc_res instanceof Result_NoneAPIErrorZ.Result_NoneAPIErrorZ_OK;
+        Result__u832APIErrorZ cc_res = peer1.chan_manager.create_channel(peer2.node_id, 100000, 1000, 42, null);
+        assert cc_res instanceof Result__u832APIErrorZ.Result__u832APIErrorZ_OK;
 
         // Previously, this was a SEGFAULT instead of get_funding_txo() returning null.
         ChannelDetails pre_funding_chan = peer1.chan_manager.list_channels()[0];
@@ -741,15 +741,17 @@ class HumanObjectPeerTestInstance {
         InvoiceFeatures invoice_features = ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK) invoice).res.features();
         RouteHint[] route_hints = ((Result_InvoiceSignOrCreationErrorZ.Result_InvoiceSignOrCreationErrorZ_OK) invoice).res.route_hints();
 
-        Result_RouteLightningErrorZ route_res = UtilMethods.get_route(peer1.chan_manager.get_our_node_id(), peer1.router.get_network_graph(), peer2.node_id, invoice_features, peer1_chans, route_hints, 10000000, 42, peer1.logger);
+        Result_RouteLightningErrorZ route_res = UtilMethods.get_route(
+                peer1.chan_manager.get_our_node_id(), peer1.router.get_network_graph(), peer2.node_id, invoice_features,
+                peer1_chans, route_hints, 10000000, 42, peer1.logger, Scorer.with_default().as_Score());
         assert route_res instanceof Result_RouteLightningErrorZ.Result_RouteLightningErrorZ_OK;
         Route route = ((Result_RouteLightningErrorZ.Result_RouteLightningErrorZ_OK) route_res).res;
         assert route.get_paths().length == 1;
         assert route.get_paths()[0].length == 1;
         assert route.get_paths()[0][0].get_fee_msat() == 10000000;
 
-        Result_NonePaymentSendFailureZ payment_res = peer1.chan_manager.send_payment(route, payment_hash, payment_secret);
-        assert payment_res instanceof Result_NonePaymentSendFailureZ.Result_NonePaymentSendFailureZ_OK;
+        Result_PaymentIdPaymentSendFailureZ payment_res = peer1.chan_manager.send_payment(route, payment_hash, payment_secret);
+        assert payment_res instanceof Result_PaymentIdPaymentSendFailureZ.Result_PaymentIdPaymentSendFailureZ_OK;
 
         RouteHop[][] hops = new RouteHop[1][1];
         byte[] hop_pubkey = new byte[33];
@@ -758,7 +760,7 @@ class HumanObjectPeerTestInstance {
         hops[0][0] = RouteHop.of(hop_pubkey, NodeFeatures.known(), 42, ChannelFeatures.known(), 100, 0);
         Route r2 = Route.of(hops);
         payment_res = peer1.chan_manager.send_payment(r2, payment_hash, payment_secret);
-        assert payment_res instanceof Result_NonePaymentSendFailureZ.Result_NonePaymentSendFailureZ_Err;
+        assert payment_res instanceof Result_PaymentIdPaymentSendFailureZ.Result_PaymentIdPaymentSendFailureZ_Err;
 
         if (reload_peers) {
             if (use_chan_manager_constructor) {
index 8f060039e22143debe579e968553cefe0fe37b58..660984197306f84e4bb009de8f9fa897cfadb378 100644 (file)
@@ -280,8 +280,12 @@ public class PeerTest {
         long inbound_payment = bindings.ChannelManager_create_inbound_payment(peer2.chan_manager, no_min_val, 7200, 42);
         bindings.COption_u64Z_free(no_min_val);
         long netgraph = bindings.NetGraphMsgHandler_get_network_graph(peer1.router);
+        long scorer = bindings.Scorer_default();
+        long scorer_interface = bindings.Scorer_as_Score(scorer);
         long route = bindings.get_route(peer1.node_id, netgraph, peer2.node_id, 0L, peer1_chans,
-                new long[0], 1000, 42, peer1.logger);
+                new long[0], 1000, 42, peer1.logger, scorer_interface);
+        bindings.Score_free(scorer_interface);
+        bindings.Scorer_free(scorer);
         for (long chan : peer1_chans) bindings.ChannelDetails_free(chan);
         assert bindings.LDKCResult_RouteLightningErrorZ_result_ok(route);
         bindings.NetworkGraph_free(netgraph);