]> git.bitcoin.ninja Git - ldk-java/commitdiff
Update PeerTest for new trait-object-return call semantics
authorMatt Corallo <git@bluematt.me>
Thu, 2 Dec 2021 19:43:51 +0000 (19:43 +0000)
committerMatt Corallo <git@bluematt.me>
Thu, 2 Dec 2021 19:55:55 +0000 (19:55 +0000)
src/test/java/org/ldk/PeerTest.java

index 2aee078486f52c93296be157786b8e6aeba26dc2..fe157b95eb40cfd9307a32246a0d915d2dc25f85 100644 (file)
@@ -35,7 +35,6 @@ public class PeerTest {
         bindings.LDKBroadcasterInterface broad_trait;
         bindings.LDKLogger log_trait;
         bindings.LDKWatch watcher;
-        ArrayList<Long> results_to_free;
 
         Peer(byte seed) {
             this.log_trait = (String arg)-> System.out.println(seed + ": " + arg);
@@ -45,7 +44,6 @@ public class PeerTest {
             this.broad_trait = tx -> {
                 // We should broadcast
             };
-            this.results_to_free = new ArrayList<>();
             this.tx_broadcaster = bindings.LDKBroadcasterInterface_new(this.broad_trait);
             this.monitors = new HashMap<>();
             this.watcher = new bindings.LDKWatch() {
@@ -55,9 +53,7 @@ public class PeerTest {
                         assert monitors.put(Arrays.toString(bindings.OutPoint_get_txid(funding_txo)), monitor) == null;
                     }
                     bindings.OutPoint_free(funding_txo);
-                    long res = bindings.CResult_NoneChannelMonitorUpdateErrZ_ok();
-                    results_to_free.add(res);
-                    return res;
+                    return bindings.CResult_NoneChannelMonitorUpdateErrZ_ok();
                 }
 
                 @Override
@@ -71,9 +67,7 @@ public class PeerTest {
                     }
                     bindings.OutPoint_free(funding_txo);
                     bindings.ChannelMonitorUpdate_free(update);
-                    long res = bindings.CResult_NoneChannelMonitorUpdateErrZ_ok();
-                    results_to_free.add(res);
-                    return res;
+                    return bindings.CResult_NoneChannelMonitorUpdateErrZ_ok();
                 }
 
                 @Override
@@ -154,9 +148,6 @@ public class PeerTest {
                     bindings.ChannelMonitor_free(mon);
                 }
             }
-            for (Long res : results_to_free) {
-                bindings.CResult_NoneChannelMonitorUpdateErrZ_free(res);
-            }
         }
     }