CSharp: fix LDKStr array decoding
[ldk-java] / c_sharp / src / org / ldk / structs / UtxoFuture.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * Represents a future resolution of a [`UtxoLookup::get_utxo`] query resolving async.
11  * 
12  * See [`UtxoResult::Async`] and [`UtxoFuture::resolve`] for more info.
13  */
14 public class UtxoFuture : CommonBase {
15         internal UtxoFuture(object _dummy, long ptr) : base(ptr) { }
16         ~UtxoFuture() {
17                 if (ptr != 0) { bindings.UtxoFuture_free(ptr); }
18         }
19
20         internal long clone_ptr() {
21                 long ret = bindings.UtxoFuture_clone_ptr(this.ptr);
22                 GC.KeepAlive(this);
23                 return ret;
24         }
25
26         /**
27          * Creates a copy of the UtxoFuture
28          */
29         public UtxoFuture clone() {
30                 long ret = bindings.UtxoFuture_clone(this.ptr);
31                 GC.KeepAlive(this);
32                 if (ret >= 0 && ret <= 4096) { return null; }
33                 org.ldk.structs.UtxoFuture ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UtxoFuture(null, ret); }
34                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
35                 return ret_hu_conv;
36         }
37
38         /**
39          * Builds a new future for later resolution.
40          */
41         public static UtxoFuture of() {
42                 long ret = bindings.UtxoFuture_new();
43                 if (ret >= 0 && ret <= 4096) { return null; }
44                 org.ldk.structs.UtxoFuture ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UtxoFuture(null, ret); }
45                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
46                 return ret_hu_conv;
47         }
48
49         /**
50          * Resolves this future against the given `graph` and with the given `result`.
51          * 
52          * This is identical to calling [`UtxoFuture::resolve`] with a dummy `gossip`, disabling
53          * forwarding the validated gossip message onwards to peers.
54          * 
55          * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
56          * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
57          * after this.
58          * 
59          * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
60          * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
61          */
62         public void resolve_without_forwarding(org.ldk.structs.NetworkGraph graph, org.ldk.structs.Result_TxOutUtxoLookupErrorZ result) {
63                 bindings.UtxoFuture_resolve_without_forwarding(this.ptr, graph == null ? 0 : graph.ptr, result != null ? result.ptr : 0);
64                 GC.KeepAlive(this);
65                 GC.KeepAlive(graph);
66                 GC.KeepAlive(result);
67                 if (this != null) { this.ptrs_to.AddLast(graph); };
68         }
69
70         /**
71          * Resolves this future against the given `graph` and with the given `result`.
72          * 
73          * The given `gossip` is used to broadcast any validated messages onwards to all peers which
74          * have available buffer space.
75          * 
76          * Because this may cause the [`NetworkGraph`]'s [`processing_queue_high`] to flip, in order
77          * to allow us to interact with peers again, you should call [`PeerManager::process_events`]
78          * after this.
79          * 
80          * [`processing_queue_high`]: crate::ln::msgs::RoutingMessageHandler::processing_queue_high
81          * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
82          */
83         public void resolve(org.ldk.structs.NetworkGraph graph, org.ldk.structs.P2PGossipSync gossip, org.ldk.structs.Result_TxOutUtxoLookupErrorZ result) {
84                 bindings.UtxoFuture_resolve(this.ptr, graph == null ? 0 : graph.ptr, gossip == null ? 0 : gossip.ptr, result != null ? result.ptr : 0);
85                 GC.KeepAlive(this);
86                 GC.KeepAlive(graph);
87                 GC.KeepAlive(gossip);
88                 GC.KeepAlive(result);
89                 if (this != null) { this.ptrs_to.AddLast(graph); };
90                 if (this != null) { this.ptrs_to.AddLast(gossip); };
91         }
92
93 }
94 } } }