Package org.ldk.structs
Class NetworkGraph
- java.lang.Object
-
- org.ldk.structs.NetworkGraph
-
public class NetworkGraph extends Object
Represents the network as nodes and channels between them
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NetworkGraph
clone()
Creates a copy of the NetworkGraphvoid
close_channel_from_update(long short_channel_id, boolean is_permanent)
Close a channel if a corresponding HTLC fail was sent.void
fail_node(byte[] _node_id, boolean is_permanent)
Marks a node in the graph as failed.protected void
finalize()
static NetworkGraph
of(byte[] genesis_hash)
Creates a new, empty, network graph.static Result_NetworkGraphDecodeErrorZ
read(byte[] ser)
Read a NetworkGraph from a byte array, created by NetworkGraph_writeReadOnlyNetworkGraph
read_only()
Returns a read-only view of the network graph.Result_NoneLightningErrorZ
update_channel(ChannelUpdate msg)
For an already known (from announcement) channel, update info about one of the directions of the channel.Result_NoneLightningErrorZ
update_channel_from_announcement(ChannelAnnouncement msg, Option_AccessZ chain_access)
Store or update channel info from a channel announcement.Result_NoneLightningErrorZ
update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Option_AccessZ chain_access)
Store or update channel info from a channel announcement without verifying the associated signatures.Result_NoneLightningErrorZ
update_channel_unsigned(UnsignedChannelUpdate msg)
For an already known (from announcement) channel, update info about one of the directions of the channel without verifying the associated signatures.Result_NoneLightningErrorZ
update_node_from_announcement(NodeAnnouncement msg)
For an already known node (from channel announcements), update its stored properties from a given node announcement.Result_NoneLightningErrorZ
update_node_from_unsigned_announcement(UnsignedNodeAnnouncement msg)
For an already known node (from channel announcements), update its stored properties from a given node announcement without verifying the associated signatures.byte[]
write()
Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
-
-
-
Method Detail
-
finalize
protected void finalize() throws Throwable
-
clone
public NetworkGraph clone()
Creates a copy of the NetworkGraph
-
write
public byte[] write()
Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
-
read
public static Result_NetworkGraphDecodeErrorZ read(byte[] ser)
Read a NetworkGraph from a byte array, created by NetworkGraph_write
-
of
public static NetworkGraph of(byte[] genesis_hash)
Creates a new, empty, network graph.
-
read_only
public ReadOnlyNetworkGraph read_only()
Returns a read-only view of the network graph.
-
update_node_from_announcement
public Result_NoneLightningErrorZ update_node_from_announcement(NodeAnnouncement msg)
For an already known node (from channel announcements), update its stored properties from a given node announcement. You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's RoutingMessageHandler implementation to call it indirectly. This may be useful to accept routing messages from a source using a protocol other than the lightning P2P protocol.
-
update_node_from_unsigned_announcement
public Result_NoneLightningErrorZ update_node_from_unsigned_announcement(UnsignedNodeAnnouncement msg)
For an already known node (from channel announcements), update its stored properties from a given node announcement without verifying the associated signatures. Because we aren't given the associated signatures here we cannot relay the node announcement to any of our peers.
-
update_channel_from_announcement
public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Option_AccessZ chain_access)
Store or update channel info from a channel announcement. You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's RoutingMessageHandler implementation to call it indirectly. This may be useful to accept routing messages from a source using a protocol other than the lightning P2P protocol. If a `chain::Access` object is provided via `chain_access`, it will be called to verify the corresponding UTXO exists on chain and is correctly-formatted.
-
update_channel_from_unsigned_announcement
public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Option_AccessZ chain_access)
Store or update channel info from a channel announcement without verifying the associated signatures. Because we aren't given the associated signatures here we cannot relay the channel announcement to any of our peers. If a `chain::Access` object is provided via `chain_access`, it will be called to verify the corresponding UTXO exists on chain and is correctly-formatted.
-
close_channel_from_update
public void close_channel_from_update(long short_channel_id, boolean is_permanent)
Close a channel if a corresponding HTLC fail was sent. If permanent, removes a channel from the local storage. May cause the removal of nodes too, if this was their last channel. If not permanent, makes channels unavailable for routing.
-
fail_node
public void fail_node(byte[] _node_id, boolean is_permanent)
Marks a node in the graph as failed.
-
update_channel
public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg)
For an already known (from announcement) channel, update info about one of the directions of the channel. You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's RoutingMessageHandler implementation to call it indirectly. This may be useful to accept routing messages from a source using a protocol other than the lightning P2P protocol.
-
update_channel_unsigned
public Result_NoneLightningErrorZ update_channel_unsigned(UnsignedChannelUpdate msg)
For an already known (from announcement) channel, update info about one of the directions of the channel without verifying the associated signatures. Because we aren't given the associated signatures here we cannot relay the channel update to any of our peers.
-
-