[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / FeeEstimator.cs
index fedc8cb2208e2b7b77b0f728f10f5dc904da1474..964cf0021f086937648e26dfb59d9dec40d44c36 100644 (file)
@@ -1,3 +1,4 @@
+
 using org.ldk.impl;
 using org.ldk.enums;
 using org.ldk.util;
@@ -5,6 +6,22 @@ using System;
 
 namespace org { namespace ldk { namespace structs {
 
+
+
+/** An implementation of FeeEstimator */
+public interface FeeEstimatorInterface {
+       /**Gets estimated satoshis of fee required per 1000 Weight-Units.
+        * 
+        * LDK will wrap this method and ensure that the value returned is no smaller than 253
+        * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
+        * 
+        * The following unit conversions can be used to convert to sats/KW:
+        * satoshis-per-byte * 250
+        * satoshis-per-kbyte / 4
+        */
+       int get_est_sat_per_1000_weight(ConfirmationTarget confirmation_target);
+}
+
 /**
  * A trait which should be implemented to provide feerate information on a number of time
  * horizons.
@@ -18,29 +35,14 @@ namespace org { namespace ldk { namespace structs {
  * called from inside the library in response to chain events, P2P events, or timer events).
  */
 public class FeeEstimator : CommonBase {
-       internal readonly bindings.LDKFeeEstimator bindings_instance;
+       internal bindings.LDKFeeEstimator bindings_instance;
+       internal long instance_idx;
+
        internal FeeEstimator(object _dummy, long ptr) : base(ptr) { bindings_instance = null; }
-       private FeeEstimator(bindings.LDKFeeEstimator arg) : base(bindings.LDKFeeEstimator_new(arg)) {
-               this.ptrs_to.AddLast(arg);
-               this.bindings_instance = arg;
-       }
        ~FeeEstimator() {
                if (ptr != 0) { bindings.FeeEstimator_free(ptr); }
        }
 
-       public interface FeeEstimatorInterface {
-               /**
-                * Gets estimated satoshis of fee required per 1000 Weight-Units.
-                * 
-                * LDK will wrap this method and ensure that the value returned is no smaller than 253
-                * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte).
-                * 
-                * The following unit conversions can be used to convert to sats/KW:
-                * satoshis-per-byte * 250
-                * satoshis-per-kbyte / 4
-                */
-               int get_est_sat_per_1000_weight(ConfirmationTarget _confirmation_target);
-       }
        private class LDKFeeEstimatorHolder { internal FeeEstimator held; }
        private class LDKFeeEstimatorImpl : bindings.LDKFeeEstimator {
                internal LDKFeeEstimatorImpl(FeeEstimatorInterface arg, LDKFeeEstimatorHolder impl_holder) { this.arg = arg; this.impl_holder = impl_holder; }
@@ -52,11 +54,19 @@ public class FeeEstimator : CommonBase {
                        return ret;
                }
        }
+
+       /** Creates a new instance of FeeEstimator from a given implementation */
        public static FeeEstimator new_impl(FeeEstimatorInterface arg) {
                LDKFeeEstimatorHolder impl_holder = new LDKFeeEstimatorHolder();
-               impl_holder.held = new FeeEstimator(new LDKFeeEstimatorImpl(arg, impl_holder));
+               LDKFeeEstimatorImpl impl = new LDKFeeEstimatorImpl(arg, impl_holder);
+               long[] ptr_idx = bindings.LDKFeeEstimator_new(impl);
+
+               impl_holder.held = new FeeEstimator(null, ptr_idx[0]);
+               impl_holder.held.instance_idx = ptr_idx[1];
+               impl_holder.held.bindings_instance = impl;
                return impl_holder.held;
        }
+
        /**
         * Gets estimated satoshis of fee required per 1000 Weight-Units.
         *