Merge pull request #50 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / Filter.java
index e1dc712cca1aebca459a927599300c127aaeb3ab..1225210dd64eda8b85887a0b7a51750cb7445ecc 100644 (file)
@@ -4,6 +4,7 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import javax.annotation.Nullable;
 
 /**
  * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
@@ -23,7 +24,7 @@ import java.util.Arrays;
  * processed later. Then, in order to block until the data has been processed, any [`Watch`]
  * invocation that has called the `Filter` must return [`TemporaryFailure`].
  * 
- * [`TemporaryFailure`]: channelmonitor::ChannelMonitorUpdateErr::TemporaryFailure
+ * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
  * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
  * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
  */
@@ -98,9 +99,9 @@ public class Filter extends CommonBase {
         */
        public Option_C2Tuple_usizeTransactionZZ register_output(WatchedOutput output) {
                long ret = bindings.Filter_register_output(this.ptr, output == null ? 0 : output.ptr & ~1);
+               if (ret >= 0 && ret < 1024) { return null; }
                Option_C2Tuple_usizeTransactionZZ ret_hu_conv = Option_C2Tuple_usizeTransactionZZ.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(this);
-               this.ptrs_to.add(output);
                return ret_hu_conv;
        }