Skip to content

Commit

Permalink
DEBUG ci hangs somewhat
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBlueMatt committed Dec 2, 2021
1 parent 8d14f99 commit ddf10d2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/org/ldk/HumanObjectPeerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,15 @@ private void bind_nio() {
try {
nio_peer_handler.bind_listener(new InetSocketAddress("127.0.0.1", i));
nio_port = i;
System.out.println("Bound to port " + i);
break;
} catch (IOException e) { assert i < 10_500; }
}
}
Peer(byte seed) {
this(null, seed);
if (use_chan_manager_constructor) {
System.out.println("constructing...");
if (use_ignore_handler) {
this.constructor = new ChannelManagerConstructor(Network.LDKNetwork_Bitcoin, UserConfig.with_default(), new byte[32], 0,
this.keys_interface, this.fee_estimator, this.chain_monitor, null, this.tx_broadcaster, this.logger);
Expand All @@ -353,6 +355,7 @@ private void bind_nio() {
}
LockableScore scorer = null;
if (use_invoice_payer) { scorer = LockableScore.of(Scorer.with_default().as_Score()); }
System.out.println("csc...");
constructor.chain_sync_completed(new ChannelManagerConstructor.EventHandler() {
@Override public void handle_event(Event event) {
synchronized (pending_manager_events) {
Expand Down Expand Up @@ -392,6 +395,7 @@ public Result_RouteLightningErrorZ find_route(byte[] payer, RouteParameters para
}
}

System.out.println("binding nio...");
this.node_id = chan_manager.get_our_node_id();
this.filter = null;
bind_nio();
Expand Down Expand Up @@ -590,6 +594,7 @@ Event[] get_manager_events(int expected_len, Peer peer1, Peer peer2) {
}
}
} else {
System.out.println("Seeking " + expected_len + " manager events...");
ArrayList<Event> l = new ArrayList<Event>();
while (l.size() < expected_len) {
Thread.yield();
Expand All @@ -600,6 +605,7 @@ Event[] get_manager_events(int expected_len, Peer peer1, Peer peer2) {
chan_manager.as_EventsProvider().process_pending_events(EventHandler.new_impl(l::add));
assert l.size() == expected_len || l.size() == 0; // We don't handle partial results
}
System.out.println("Got " + expected_len + " manager events!");
return l.toArray(new Event[0]);
}
assert res.length == expected_len;
Expand Down Expand Up @@ -723,6 +729,7 @@ TestState do_test_message_handler() throws InterruptedException {
Peer peer2 = new Peer((byte) 2);

connect_peers(peer1, peer2);
System.out.println("Connected peers...");

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;
Expand Down Expand Up @@ -819,6 +826,7 @@ TestState do_test_message_handler() throws InterruptedException {
assert route.get_paths()[0].length == 1;
assert route.get_paths()[0][0].get_fee_msat() == 10000000;

System.out.println("Sending payment...");
Result_PaymentIdPaymentSendFailureZ payment_res = peer1.chan_manager.send_payment(route, payment_hash, payment_secret);
assert payment_res instanceof Result_PaymentIdPaymentSendFailureZ.Result_PaymentIdPaymentSendFailureZ_OK;

Expand All @@ -836,6 +844,7 @@ TestState do_test_message_handler() throws InterruptedException {
}

if (reload_peers) {
System.out.println("Reloading peers...");
if (use_chan_manager_constructor) {
peer1.constructor.interrupt();
peer2.constructor.interrupt();
Expand All @@ -844,10 +853,12 @@ TestState do_test_message_handler() throws InterruptedException {
peer2.nio_peer_handler.interrupt();
}
WeakReference<Peer> op1 = new WeakReference<Peer>(peer1);
System.out.println("Constructing new Peer objects...");
peer1 = new Peer(peer1);
peer2 = new Peer(peer2);
return new TestState(op1, peer1, peer2, b.getHash());
}
System.out.println("Returning for stage two with the same peer objects...");
return new TestState(null, peer1, peer2, b.getHash());
}

Expand Down Expand Up @@ -876,6 +887,7 @@ void do_test_message_handler_b(TestState state) throws InterruptedException {
}
connect_peers(state.peer1, state.peer2);
}
System.out.println("Starting stage 2 after peers connected...");

Event[] events = state.peer2.get_manager_events(1, state.peer1, state.peer2);
assert events[0] instanceof Event.PendingHTLCsForwardable;
Expand Down

0 comments on commit ddf10d2

Please sign in to comment.