From 5159db8afc915c6934556af6e59df21bc31c57b2 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 17 Oct 2021 01:22:34 +0000 Subject: [PATCH] Update tests to upstream 0.0.102 API --- src/test/java/org/ldk/HumanObjectPeerTest.java | 14 ++++++++------ src/test/java/org/ldk/PeerTest.java | 6 +++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/ldk/HumanObjectPeerTest.java b/src/test/java/org/ldk/HumanObjectPeerTest.java index e98632e2..261902b7 100644 --- a/src/test/java/org/ldk/HumanObjectPeerTest.java +++ b/src/test/java/org/ldk/HumanObjectPeerTest.java @@ -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) { diff --git a/src/test/java/org/ldk/PeerTest.java b/src/test/java/org/ldk/PeerTest.java index 8f060039..66098419 100644 --- a/src/test/java/org/ldk/PeerTest.java +++ b/src/test/java/org/ldk/PeerTest.java @@ -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); -- 2.39.5