6 namespace org { namespace ldk { namespace structs {
9 * An interface to send a transaction to the Bitcoin network.
11 public class BroadcasterInterface : CommonBase {
12 internal readonly bindings.LDKBroadcasterInterface bindings_instance;
13 internal BroadcasterInterface(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
14 private BroadcasterInterface(bindings.LDKBroadcasterInterface arg) : base(bindings.LDKBroadcasterInterface_new(arg)) {
15 this.ptrs_to.AddLast(arg);
16 this.bindings_instance = arg;
18 ~BroadcasterInterface() {
19 if (ptr != 0) { bindings.BroadcasterInterface_free(ptr); }
22 public interface BroadcasterInterfaceInterface {
24 * Sends a list of transactions out to (hopefully) be mined.
25 * This only needs to handle the actual broadcasting of transactions, LDK will automatically
26 * rebroadcast transactions that haven't made it into a block.
28 * In some cases LDK may attempt to broadcast a transaction which double-spends another
29 * and this isn't a bug and can be safely ignored.
31 * If more than one transaction is given, these transactions should be considered to be a
32 * package and broadcast together. Some of the transactions may or may not depend on each other,
33 * be sure to manage both cases correctly.
35 * Bitcoin transaction packages are defined in BIP 331 and here:
36 * https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md
38 void broadcast_transactions(byte[][] _txs);
40 private class LDKBroadcasterInterfaceHolder { internal BroadcasterInterface held; }
41 private class LDKBroadcasterInterfaceImpl : bindings.LDKBroadcasterInterface {
42 internal LDKBroadcasterInterfaceImpl(BroadcasterInterfaceInterface arg, LDKBroadcasterInterfaceHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
43 private BroadcasterInterfaceInterface arg;
44 private LDKBroadcasterInterfaceHolder impl_holder;
45 public void broadcast_transactions(byte[][] _txs) {
46 arg.broadcast_transactions(_txs);
50 public static BroadcasterInterface new_impl(BroadcasterInterfaceInterface arg) {
51 LDKBroadcasterInterfaceHolder impl_holder = new LDKBroadcasterInterfaceHolder();
52 impl_holder.held = new BroadcasterInterface(new LDKBroadcasterInterfaceImpl(arg, impl_holder));
53 return impl_holder.held;
56 * Sends a list of transactions out to (hopefully) be mined.
57 * This only needs to handle the actual broadcasting of transactions, LDK will automatically
58 * rebroadcast transactions that haven't made it into a block.
60 * In some cases LDK may attempt to broadcast a transaction which double-spends another
61 * and this isn't a bug and can be safely ignored.
63 * If more than one transaction is given, these transactions should be considered to be a
64 * package and broadcast together. Some of the transactions may or may not depend on each other,
65 * be sure to manage both cases correctly.
67 * Bitcoin transaction packages are defined in BIP 331 and here:
68 * https://github.com/bitcoin/bitcoin/blob/master/doc/policy/packages.md
70 public void broadcast_transactions(byte[][] txs) {
71 bindings.BroadcasterInterface_broadcast_transactions(this.ptr, txs);