6 namespace org { namespace ldk { namespace structs {
9 * A `enum` signalling to the [`OutputSweeper`] that it should delay spending an output until a
10 * future block height is reached.
12 public class SpendingDelay : CommonBase {
13 protected SpendingDelay(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.SpendingDelay_free(ptr); }
18 internal static SpendingDelay constr_from_ptr(long ptr) {
19 long raw_ty = bindings.LDKSpendingDelay_ty_from_ptr(ptr);
21 case 0: return new SpendingDelay_Relative(ptr);
22 case 1: return new SpendingDelay_Absolute(ptr);
24 throw new ArgumentException("Impossible enum variant");
28 /** A SpendingDelay of type Relative */
29 public class SpendingDelay_Relative : SpendingDelay {
31 * The number of blocks until we'll generate and broadcast the spending transaction.
33 public int num_blocks;
34 internal SpendingDelay_Relative(long ptr) : base(null, ptr) {
35 this.num_blocks = bindings.LDKSpendingDelay_Relative_get_num_blocks(ptr);
38 /** A SpendingDelay of type Absolute */
39 public class SpendingDelay_Absolute : SpendingDelay {
41 * The height at which we'll generate and broadcast the spending transaction.
44 internal SpendingDelay_Absolute(long ptr) : base(null, ptr) {
45 this.height = bindings.LDKSpendingDelay_Absolute_get_height(ptr);
48 internal long clone_ptr() {
49 long ret = bindings.SpendingDelay_clone_ptr(this.ptr);
55 * Creates a copy of the SpendingDelay
57 public SpendingDelay clone() {
58 long ret = bindings.SpendingDelay_clone(this.ptr);
60 if (ret >= 0 && ret <= 4096) { return null; }
61 org.ldk.structs.SpendingDelay ret_hu_conv = org.ldk.structs.SpendingDelay.constr_from_ptr(ret);
62 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
67 * Utility method to constructs a new Relative-variant SpendingDelay
69 public static SpendingDelay relative(int num_blocks) {
70 long ret = bindings.SpendingDelay_relative(num_blocks);
71 GC.KeepAlive(num_blocks);
72 if (ret >= 0 && ret <= 4096) { return null; }
73 org.ldk.structs.SpendingDelay ret_hu_conv = org.ldk.structs.SpendingDelay.constr_from_ptr(ret);
74 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
79 * Utility method to constructs a new Absolute-variant SpendingDelay
81 public static SpendingDelay absolute(int height) {
82 long ret = bindings.SpendingDelay_absolute(height);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.SpendingDelay ret_hu_conv = org.ldk.structs.SpendingDelay.constr_from_ptr(ret);
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };