]> git.bitcoin.ninja Git - ldk-java/blob - src/main/java/org/ldk/structs/ChainMonitor.java
Fix race in tests
[ldk-java] / src / main / java / org / ldk / structs / ChainMonitor.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class ChainMonitor extends CommonBase {
10         ChainMonitor(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.ChainMonitor_free(ptr); }
15         }
16
17         public void block_connected(byte[] header, TwoTuple<Long, byte[]>[] txdata, int height) {
18                 bindings.ChainMonitor_block_connected(this.ptr, header, Arrays.stream(txdata).mapToLong(arr_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(arr_conv_24.a, arr_conv_24.b)).toArray(), height);
19                 /* TODO 2 TwoTuple<Long, byte[]>  */;
20         }
21
22         public void block_disconnected(byte[] header, int disconnected_height) {
23                 bindings.ChainMonitor_block_disconnected(this.ptr, header, disconnected_height);
24         }
25
26         public static ChainMonitor constructor_new(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest) {
27                 long ret = bindings.ChainMonitor_new(chain_source == null ? 0 : chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr);
28                 ChainMonitor ret_hu_conv = new ChainMonitor(null, ret);
29                 ret_hu_conv.ptrs_to.add(chain_source);
30                 ret_hu_conv.ptrs_to.add(broadcaster);
31                 ret_hu_conv.ptrs_to.add(logger);
32                 ret_hu_conv.ptrs_to.add(feeest);
33                 return ret_hu_conv;
34         }
35
36         public Watch as_Watch() {
37                 long ret = bindings.ChainMonitor_as_Watch(this.ptr);
38                 Watch ret_hu_conv = new Watch(null, ret);
39                 ret_hu_conv.ptrs_to.add(this);
40                 return ret_hu_conv;
41         }
42
43         public EventsProvider as_EventsProvider() {
44                 long ret = bindings.ChainMonitor_as_EventsProvider(this.ptr);
45                 EventsProvider ret_hu_conv = new EventsProvider(null, ret);
46                 ret_hu_conv.ptrs_to.add(this);
47                 return ret_hu_conv;
48         }
49
50 }