X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FBroadcasterInterface.java;h=a0c8fb9b55a435261e78472594bd1fbc7e7bbccb;hb=2bb592fb946e316dba9f4d1123f8ac72ff4e9bf8;hp=0ecc2feb6789cde12c5814a77c0ce738b2330018;hpb=eab9331afd014558a982441138e222999a9955d1;p=ldk-java diff --git a/src/main/java/org/ldk/structs/BroadcasterInterface.java b/src/main/java/org/ldk/structs/BroadcasterInterface.java index 0ecc2feb..a0c8fb9b 100644 --- a/src/main/java/org/ldk/structs/BroadcasterInterface.java +++ b/src/main/java/org/ldk/structs/BroadcasterInterface.java @@ -38,28 +38,52 @@ public class BroadcasterInterface extends CommonBase { } public static interface BroadcasterInterfaceInterface { /** - * Sends a transaction out to (hopefully) be mined. + * Sends a list of transactions out to (hopefully) be mined. + * This only needs to handle the actual broadcasting of transactions, LDK will automatically + * rebroadcast transactions that haven't made it into a block. + * + * In some cases LDK may attempt to broadcast a transaction which double-spends another + * and this isn't a bug and can be safely ignored. + * + * If more than one transaction is given, these transactions should be considered to be a + * package and broadcast together. Some of the transactions may or may not depend on each other, + * be sure to manage both cases correctly. + * + * Bitcoin transaction packages are defined in BIP 331 and here: + * */ - void broadcast_transaction(byte[] tx); + void broadcast_transactions(byte[][] txs); } private static class LDKBroadcasterInterfaceHolder { BroadcasterInterface held; } public static BroadcasterInterface new_impl(BroadcasterInterfaceInterface arg) { final LDKBroadcasterInterfaceHolder impl_holder = new LDKBroadcasterInterfaceHolder(); impl_holder.held = new BroadcasterInterface(new bindings.LDKBroadcasterInterface() { - @Override public void broadcast_transaction(byte[] tx) { - arg.broadcast_transaction(tx); + @Override public void broadcast_transactions(byte[][] txs) { + arg.broadcast_transactions(txs); Reference.reachabilityFence(arg); } }); return impl_holder.held; } /** - * Sends a transaction out to (hopefully) be mined. + * Sends a list of transactions out to (hopefully) be mined. + * This only needs to handle the actual broadcasting of transactions, LDK will automatically + * rebroadcast transactions that haven't made it into a block. + * + * In some cases LDK may attempt to broadcast a transaction which double-spends another + * and this isn't a bug and can be safely ignored. + * + * If more than one transaction is given, these transactions should be considered to be a + * package and broadcast together. Some of the transactions may or may not depend on each other, + * be sure to manage both cases correctly. + * + * Bitcoin transaction packages are defined in BIP 331 and here: + * */ - public void broadcast_transaction(byte[] tx) { - bindings.BroadcasterInterface_broadcast_transaction(this.ptr, tx); + public void broadcast_transactions(byte[][] txs) { + bindings.BroadcasterInterface_broadcast_transactions(this.ptr, txs); Reference.reachabilityFence(this); - Reference.reachabilityFence(tx); + Reference.reachabilityFence(txs); } }