Merge pull request #50 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / Filter.java
index 701e70f5c0ad06ff894c34aada3f4e38b437348f..1225210dd64eda8b85887a0b7a51750cb7445ecc 100644 (file)
@@ -24,7 +24,7 @@ import javax.annotation.Nullable;
  * 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
  */
@@ -99,10 +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 < 1024) { return null; }
+               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;
        }