Send a payment!
[ldk-java] / src / test / java / org / ldk / ManualMsgHandlingPeerTest.java
index 010b40754a32aceec5818347bf6eb585f518aedc..82f0ade1464030543cce8236488f7e5a6211b92f 100644 (file)
@@ -2,6 +2,7 @@ package org.ldk;
 
 import org.junit.jupiter.api.Test;
 import org.ldk.impl.bindings;
+import org.ldk.enums.*;
 
 public class ManualMsgHandlingPeerTest {
     @Test
@@ -11,97 +12,97 @@ public class ManualMsgHandlingPeerTest {
         });
         long chan_handler = bindings.LDKChannelMessageHandler_new(new bindings.LDKChannelMessageHandler() {
             @Override
-            public void handle_open_channel(long their_node_id, long their_features, long msg) {
+            public void handle_open_channel(byte[] their_node_id, long their_features, long msg) {
 
             }
 
             @Override
-            public void handle_accept_channel(long their_node_id, long their_features, long msg) {
+            public void handle_accept_channel(byte[] their_node_id, long their_features, long msg) {
 
             }
 
             @Override
-            public void handle_funding_created(long their_node_id, long msg) {
+            public void handle_funding_created(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_funding_signed(long their_node_id, long msg) {
+            public void handle_funding_signed(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_funding_locked(long their_node_id, long msg) {
+            public void handle_funding_locked(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_shutdown(long their_node_id, long msg) {
+            public void handle_shutdown(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_closing_signed(long their_node_id, long msg) {
+            public void handle_closing_signed(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_update_add_htlc(long their_node_id, long msg) {
+            public void handle_update_add_htlc(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_update_fulfill_htlc(long their_node_id, long msg) {
+            public void handle_update_fulfill_htlc(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_update_fail_htlc(long their_node_id, long msg) {
+            public void handle_update_fail_htlc(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_update_fail_malformed_htlc(long their_node_id, long msg) {
+            public void handle_update_fail_malformed_htlc(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_commitment_signed(long their_node_id, long msg) {
+            public void handle_commitment_signed(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_revoke_and_ack(long their_node_id, long msg) {
+            public void handle_revoke_and_ack(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_update_fee(long their_node_id, long msg) {
+            public void handle_update_fee(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_announcement_signatures(long their_node_id, long msg) {
+            public void handle_announcement_signatures(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void peer_disconnected(long their_node_id, boolean no_connection_possible) {
+            public void peer_disconnected(byte[] their_node_id, boolean no_connection_possible) {
 
             }
 
             @Override
-            public void peer_connected(long their_node_id, long msg) {
+            public void peer_connected(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_channel_reestablish(long their_node_id, long msg) {
+            public void handle_channel_reestablish(byte[] their_node_id, long msg) {
 
             }
 
             @Override
-            public void handle_error(long their_node_id, long msg) {
+            public void handle_error(byte[] their_node_id, long msg) {
 
             }
         }, () -> 0);
@@ -121,10 +122,10 @@ public class ManualMsgHandlingPeerTest {
             @Override public long get_next_channel_announcements(long starting_point, byte batch_amount) {
                 return 0;
             }
-            @Override public long get_next_node_announcements(long starting_point, byte batch_amount) {
+            @Override public long get_next_node_announcements(byte[] starting_point, byte batch_amount) {
                 return 0;
             }
-            @Override public boolean should_request_full_sync(long node_id) {
+            @Override public boolean should_request_full_sync(byte[] node_id) {
                 return false;
             }
         });
@@ -135,6 +136,9 @@ public class ManualMsgHandlingPeerTest {
 
         long peer_manager = bindings.PeerManager_new(message_handler, our_node_secret, random_data, logger);
 
+        // Test Level_max() since its the only place we create a java object from a Rust-returned enum.
+        assert bindings.Level_max() == LDKLevel.LDKLevel_Trace;
+
         // Note that we can't rely on finalizer order, so don't bother trying to rely on it here
         bindings.Logger_free(logger);
         bindings.ChannelMessageHandler_free(chan_handler);