[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / BroadcasterInterface.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 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10 /**
11  * An interface to send a transaction to the Bitcoin network.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class BroadcasterInterface extends CommonBase {
15         final bindings.LDKBroadcasterInterface bindings_instance;
16         BroadcasterInterface(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
17         private BroadcasterInterface(bindings.LDKBroadcasterInterface arg) {
18                 super(bindings.LDKBroadcasterInterface_new(arg));
19                 this.ptrs_to.add(arg);
20                 this.bindings_instance = arg;
21         }
22         @Override @SuppressWarnings("deprecation")
23         protected void finalize() throws Throwable {
24                 if (ptr != 0) { bindings.BroadcasterInterface_free(ptr); } super.finalize();
25         }
26         /**
27          * Destroys the object, freeing associated resources. After this call, any access
28          * to this object may result in a SEGFAULT or worse.
29          *
30          * You should generally NEVER call this method. You should let the garbage collector
31          * do this for you when it finalizes objects. However, it may be useful for types
32          * which represent locks and should be closed immediately to avoid holding locks
33          * until the GC runs.
34          */
35         public void destroy() {
36                 if (ptr != 0) { bindings.BroadcasterInterface_free(ptr); }
37                 ptr = 0;
38         }
39         public static interface BroadcasterInterfaceInterface {
40                 /**
41                  * Sends a list of transactions out to (hopefully) be mined.
42                  * This only needs to handle the actual broadcasting of transactions, LDK will automatically
43                  * rebroadcast transactions that haven't made it into a block.
44                  * 
45                  * In some cases LDK may attempt to broadcast a transaction which double-spends another
46                  * and this isn't a bug and can be safely ignored.
47                  * 
48                  * If more than one transaction is given, these transactions should be considered to be a
49                  * package and broadcast together. Some of the transactions may or may not depend on each other,
50                  * be sure to manage both cases correctly.
51                  * 
52                  * Bitcoin transaction packages are defined in BIP 331 and here:
53                  * <https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md>
54                  */
55                 void broadcast_transactions(byte[][] txs);
56         }
57         private static class LDKBroadcasterInterfaceHolder { BroadcasterInterface held; }
58         public static BroadcasterInterface new_impl(BroadcasterInterfaceInterface arg) {
59                 final LDKBroadcasterInterfaceHolder impl_holder = new LDKBroadcasterInterfaceHolder();
60                 impl_holder.held = new BroadcasterInterface(new bindings.LDKBroadcasterInterface() {
61                         @Override public void broadcast_transactions(byte[][] txs) {
62                                 arg.broadcast_transactions(txs);
63                                 Reference.reachabilityFence(arg);
64                         }
65                 });
66                 return impl_holder.held;
67         }
68         /**
69          * Sends a list of transactions out to (hopefully) be mined.
70          * This only needs to handle the actual broadcasting of transactions, LDK will automatically
71          * rebroadcast transactions that haven't made it into a block.
72          * 
73          * In some cases LDK may attempt to broadcast a transaction which double-spends another
74          * and this isn't a bug and can be safely ignored.
75          * 
76          * If more than one transaction is given, these transactions should be considered to be a
77          * package and broadcast together. Some of the transactions may or may not depend on each other,
78          * be sure to manage both cases correctly.
79          * 
80          * Bitcoin transaction packages are defined in BIP 331 and here:
81          * <https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md>
82          */
83         public void broadcast_transactions(byte[][] txs) {
84                 bindings.BroadcasterInterface_broadcast_transactions(this.ptr, txs);
85                 Reference.reachabilityFence(this);
86                 Reference.reachabilityFence(txs);
87         }
88
89 }