Module lightning::ln::msgs[][src]

Expand description

Wire messages, traits representing wire message handlers, and a few error types live here.

For a normal node you probably don’t need to use anything here, however, if you wish to split a node into an internet-facing route/message socket handling daemon and a separate daemon (or server entirely) which handles only channel-related messages you may wish to implement ChannelMessageHandler yourself and use it to re-serialize messages and pass them across daemons/servers.

Note that if you go with such an architecture (instead of passing raw socket events to a non-internet-facing system) you trust the frontend internet-facing system to not lie about the source node_id of the message, however this does allow you to significantly reduce bandwidth between the systems as routing messages can represent a significant chunk of bandwidth usage (especially for non-channel-publicly-announcing nodes). As an alternate design which avoids this issue, if you have sufficient bidirectional bandwidth between your systems, you may send raw socket events into your non-internet-facing system and then send routing events back to track the network on the less-secure system.

Structs

AcceptChannel

An accept_channel message to be sent or received from a peer

AnnouncementSignatures

An announcement_signatures message to be sent or received from a peer

ChannelAnnouncement

A channel_announcement message to be sent or received from a peer

ChannelReestablish

A channel_reestablish message to be sent or received from a peer

ChannelUpdate

A channel_update message to be sent or received from a peer

ClosingSigned

A closing_signed message to be sent or received from a peer

CommitmentSigned

A commitment_signed message to be sent or received from a peer

CommitmentUpdate

Struct used to return values from revoke_and_ack messages, containing a bunch of commitment transaction updates if they were pending.

DataLossProtect

Proof that the sender knows the per-commitment secret of the previous commitment transaction. This is used to convince the recipient that the channel is at a certain commitment number even if they lost that data due to a local failure. Of course, the peer may lie and even later commitments may have been revoked.

ErrorMessage

An error message to be sent or received from a peer

FundingCreated

A funding_created message to be sent or received from a peer

FundingLocked

A funding_locked message to be sent or received from a peer

FundingSigned

A funding_signed message to be sent or received from a peer

GossipTimestampFilter

A gossip_timestamp_filter message is used by a node to request gossip relay for messages in the requested time range when the gossip_queries feature has been negotiated.

Init

An init message to be sent or received from a peer

LightningError

An Err type for failure to process messages.

NodeAnnouncement

A node_announcement message to be sent or received from a peer

OpenChannel

An open_channel message to be sent or received from a peer

Ping

A ping message to be sent or received from a peer

Pong

A pong message to be sent or received from a peer

QueryChannelRange

A query_channel_range message is used to query a peer for channel UTXOs in a range of blocks. The recipient of a query makes a best effort to reply to the query using one or more reply_channel_range messages.

QueryShortChannelIds

A query_short_channel_ids message is used to query a peer for routing gossip messages related to one or more short_channel_ids. The query recipient will reply with the latest, if available, channel_announcement, channel_update and node_announcement messages it maintains for the requested short_channel_ids followed by a reply_short_channel_ids_end message. The short_channel_ids sent in this query are encoded. We only support encoding_type=0 uncompressed serialization and do not support encoding_type=1 zlib serialization.

ReplyChannelRange

A reply_channel_range message is a reply to a query_channel_range message. Multiple reply_channel_range messages can be sent in reply to a single query_channel_range message. The query recipient makes a best effort to respond based on their local network view which may not be a perfect view of the network. The short_channel_ids in the reply are encoded. We only support encoding_type=0 uncompressed serialization and do not support encoding_type=1 zlib serialization.

ReplyShortChannelIdsEnd

A reply_short_channel_ids_end message is sent as a reply to a query_short_channel_ids message. The query recipient makes a best effort to respond based on their local network view which may not be a perfect view of the network.

RevokeAndACK

A revoke_and_ack message to be sent or received from a peer

Shutdown

A shutdown message to be sent or received from a peer

UnsignedChannelAnnouncement

The unsigned part of a channel_announcement

UnsignedChannelUpdate

The unsigned part of a channel_update

UnsignedNodeAnnouncement

The unsigned part of a node_announcement

UpdateAddHTLC

An update_add_htlc message to be sent or received from a peer

UpdateFailHTLC

An update_fail_htlc message to be sent or received from a peer

UpdateFailMalformedHTLC

An update_fail_malformed_htlc message to be sent or received from a peer

UpdateFee

An update_fee message to be sent or received from a peer

UpdateFulfillHTLC

An update_fulfill_htlc message to be sent or received from a peer

Enums

DecodeError

An error in decoding a message or struct.

ErrorAction

Used to put an error message in a LightningError

HTLCFailChannelUpdate

The information we received from a peer along the route of a payment we originated. This is returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.

NetAddress

An address which can be used to connect to a remote peer

OptionalField

Messages could have optional fields to use with extended features As we wish to serialize these differently from Options (Options get a tag byte, but OptionalFeild simply gets Present if there are enough bytes to read into it), we have a separate enum type for them. (C-not exported) due to a free generic in T

Traits

ChannelMessageHandler

A trait to describe an object which can receive channel messages.

RoutingMessageHandler

A trait to describe an object which can receive routing messages.