6 namespace org { namespace ldk { namespace structs {
10 * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
11 * This is used to convince the recipient that the channel is at a certain commitment
12 * number even if they lost that data due to a local failure. Of course, the peer may lie
13 * and even later commitments may have been revoked.
15 public class DataLossProtect : CommonBase {
16 internal DataLossProtect(object _dummy, long ptr) : base(ptr) { }
18 if (ptr != 0) { bindings.DataLossProtect_free(ptr); }
22 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
23 * belonging to the recipient
25 public byte[] get_your_last_per_commitment_secret() {
26 byte[] ret = bindings.DataLossProtect_get_your_last_per_commitment_secret(this.ptr);
32 * Proof that the sender knows the per-commitment secret of a specific commitment transaction
33 * belonging to the recipient
35 public void set_your_last_per_commitment_secret(byte[] val) {
36 bindings.DataLossProtect_set_your_last_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
42 * The sender's per-commitment point for their current commitment transaction
44 public byte[] get_my_current_per_commitment_point() {
45 byte[] ret = bindings.DataLossProtect_get_my_current_per_commitment_point(this.ptr);
51 * The sender's per-commitment point for their current commitment transaction
53 public void set_my_current_per_commitment_point(byte[] val) {
54 bindings.DataLossProtect_set_my_current_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
60 * Constructs a new DataLossProtect given each field
62 public static DataLossProtect of(byte[] your_last_per_commitment_secret_arg, byte[] my_current_per_commitment_point_arg) {
63 long ret = bindings.DataLossProtect_new(InternalUtils.check_arr_len(your_last_per_commitment_secret_arg, 32), InternalUtils.check_arr_len(my_current_per_commitment_point_arg, 33));
64 GC.KeepAlive(your_last_per_commitment_secret_arg);
65 GC.KeepAlive(my_current_per_commitment_point_arg);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DataLossProtect(null, ret); }
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
72 internal long clone_ptr() {
73 long ret = bindings.DataLossProtect_clone_ptr(this.ptr);
79 * Creates a copy of the DataLossProtect
81 public DataLossProtect clone() {
82 long ret = bindings.DataLossProtect_clone(this.ptr);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.DataLossProtect ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DataLossProtect(null, ret); }
86 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91 * Checks if two DataLossProtects contain equal inner contents.
92 * This ignores pointers and is_owned flags and looks at the values in fields.
93 * Two objects with NULL inner values will be considered "equal" here.
95 public bool eq(org.ldk.structs.DataLossProtect b) {
96 bool ret = bindings.DataLossProtect_eq(this.ptr, b == null ? 0 : b.ptr);
99 if (this != null) { this.ptrs_to.AddLast(b); };
103 public override bool Equals(object o) {
104 if (!(o is DataLossProtect)) return false;
105 return this.eq((DataLossProtect)o);