[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / P2PGossipSync.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  * Receives and validates network updates from peers,
11  * stores authentic and relevant data as a network graph.
12  * This network graph is then used for routing payments.
13  * Provides interface to help with initial routing sync by
14  * serving historical announcements.
15  */
16 public class P2PGossipSync : CommonBase {
17         internal P2PGossipSync(object _dummy, long ptr) : base(ptr) { }
18         ~P2PGossipSync() {
19                 if (ptr != 0) { bindings.P2PGossipSync_free(ptr); }
20         }
21
22         /**
23          * Creates a new tracker of the actual state of the network of channels and nodes,
24          * assuming an existing [`NetworkGraph`].
25          * UTXO lookup is used to make sure announced channels exist on-chain, channel data is
26          * correct, and the announcement is signed with channel owners' keys.
27          */
28         public static P2PGossipSync of(org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Option_UtxoLookupZ utxo_lookup, org.ldk.structs.Logger logger) {
29                 long ret = bindings.P2PGossipSync_new(network_graph == null ? 0 : network_graph.ptr, utxo_lookup.ptr, logger.ptr);
30                 GC.KeepAlive(network_graph);
31                 GC.KeepAlive(utxo_lookup);
32                 GC.KeepAlive(logger);
33                 if (ret >= 0 && ret <= 4096) { return null; }
34                 org.ldk.structs.P2PGossipSync ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.P2PGossipSync(null, ret); }
35                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
36                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(network_graph); };
37                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(utxo_lookup); };
38                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(logger); };
39                 return ret_hu_conv;
40         }
41
42         /**
43          * Adds a provider used to check new announcements. Does not affect
44          * existing announcements unless they are updated.
45          * Add, update or remove the provider would replace the current one.
46          */
47         public void add_utxo_lookup(org.ldk.structs.Option_UtxoLookupZ utxo_lookup) {
48                 bindings.P2PGossipSync_add_utxo_lookup(this.ptr, utxo_lookup.ptr);
49                 GC.KeepAlive(this);
50                 GC.KeepAlive(utxo_lookup);
51                 if (this != null) { this.ptrs_to.AddLast(utxo_lookup); };
52         }
53
54         /**
55          * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg.
56          * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is
57          */
58         public RoutingMessageHandler as_RoutingMessageHandler() {
59                 long ret = bindings.P2PGossipSync_as_RoutingMessageHandler(this.ptr);
60                 GC.KeepAlive(this);
61                 if (ret >= 0 && ret <= 4096) { return null; }
62                 RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret);
63                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg.
69          * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is
70          */
71         public MessageSendEventsProvider as_MessageSendEventsProvider() {
72                 long ret = bindings.P2PGossipSync_as_MessageSendEventsProvider(this.ptr);
73                 GC.KeepAlive(this);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 MessageSendEventsProvider ret_hu_conv = new MessageSendEventsProvider(null, ret);
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
77                 return ret_hu_conv;
78         }
79
80 }
81 } } }