Struct IgnoringMessageHandler
pub struct IgnoringMessageHandler {}
Expand description
A dummy struct which implements RoutingMessageHandler
without storing any routing information
or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
Trait Implementations§
§impl CustomMessageHandler for IgnoringMessageHandler
impl CustomMessageHandler for IgnoringMessageHandler
§fn handle_custom_message(
&self,
_msg: Infallible,
_sender_node_id: &PublicKey,
) -> Result<(), LightningError>
fn handle_custom_message( &self, _msg: Infallible, _sender_node_id: &PublicKey, ) -> Result<(), LightningError>
Handles the given message sent from
sender_node_id
, possibly producing messages for
CustomMessageHandler::get_and_clear_pending_msg
to return and thus for PeerManager
to send.§fn get_and_clear_pending_msg(
&self,
) -> Vec<(PublicKey, <IgnoringMessageHandler as CustomMessageReader>::CustomMessage)>
fn get_and_clear_pending_msg( &self, ) -> Vec<(PublicKey, <IgnoringMessageHandler as CustomMessageReader>::CustomMessage)>
Returns the list of pending messages that were generated by the handler, clearing the list
in the process. Each message is paired with the node id of the intended recipient. If no
connection to the node exists, then the message is simply not sent.
§fn provided_node_features(&self) -> Features<NodeContext>
fn provided_node_features(&self) -> Features<NodeContext>
Gets the node feature flags which this handler itself supports. All available handlers are
queried similarly and their feature flags are OR’d together to form the
NodeFeatures
which are broadcasted in our NodeAnnouncement
message.§fn provided_init_features(
&self,
_their_node_id: &PublicKey,
) -> Features<InitContext>
fn provided_init_features( &self, _their_node_id: &PublicKey, ) -> Features<InitContext>
Gets the init feature flags which should be sent to the given peer. All available handlers
are queried similarly and their feature flags are OR’d together to form the
InitFeatures
which are sent in our Init
message.§impl CustomMessageReader for IgnoringMessageHandler
impl CustomMessageReader for IgnoringMessageHandler
§type CustomMessage = Infallible
type CustomMessage = Infallible
The type of the message decoded by the implementation.
§fn read<R>(
&self,
_message_type: u16,
_buffer: &mut R,
) -> Result<Option<<IgnoringMessageHandler as CustomMessageReader>::CustomMessage>, DecodeError>where
R: Read,
fn read<R>(
&self,
_message_type: u16,
_buffer: &mut R,
) -> Result<Option<<IgnoringMessageHandler as CustomMessageReader>::CustomMessage>, DecodeError>where
R: Read,
Decodes a custom message to
CustomMessageType
. If the given message type is known to the
implementation and the message could be decoded, must return Ok(Some(message))
. If the
message type is unknown to the implementation, must return Ok(None)
. If a decoding error
occur, must return Err(DecodeError::X)
where X
details the encountered error.§impl CustomOnionMessageHandler for IgnoringMessageHandler
impl CustomOnionMessageHandler for IgnoringMessageHandler
§type CustomMessage = Infallible
type CustomMessage = Infallible
The message known to the handler. To support multiple message types, you may want to make this
an enum with a variant for each supported message.
§fn handle_custom_message(&self, _msg: Infallible) -> Option<Infallible>
fn handle_custom_message(&self, _msg: Infallible) -> Option<Infallible>
Called with the custom message that was received, returning a response to send, if any. Read more
§fn read_custom_message<R>(
&self,
_msg_type: u64,
_buffer: &mut R,
) -> Result<Option<Infallible>, DecodeError>
fn read_custom_message<R>( &self, _msg_type: u64, _buffer: &mut R, ) -> Result<Option<Infallible>, DecodeError>
Read a custom message of type
message_type
from buffer
, returning Ok(None)
if the
message type is unknown.§fn release_pending_custom_messages(
&self,
) -> Vec<PendingOnionMessage<Infallible>>
fn release_pending_custom_messages( &self, ) -> Vec<PendingOnionMessage<Infallible>>
Releases any
Self::CustomMessage
s that need to be sent. Read more§impl Deref for IgnoringMessageHandler
impl Deref for IgnoringMessageHandler
§type Target = IgnoringMessageHandler
type Target = IgnoringMessageHandler
The resulting type after dereferencing.
§fn deref(&self) -> &IgnoringMessageHandler
fn deref(&self) -> &IgnoringMessageHandler
Dereferences the value.
§impl MessageSendEventsProvider for IgnoringMessageHandler
impl MessageSendEventsProvider for IgnoringMessageHandler
§fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent>
fn get_and_clear_pending_msg_events(&self) -> Vec<MessageSendEvent>
Gets the list of pending events which were generated by previous actions, clearing the list
in the process.
§impl OffersMessageHandler for IgnoringMessageHandler
impl OffersMessageHandler for IgnoringMessageHandler
§fn handle_message(&self, _msg: OffersMessage) -> Option<OffersMessage>
fn handle_message(&self, _msg: OffersMessage) -> Option<OffersMessage>
Handles the given message by either responding with an
Bolt12Invoice
, sending a payment,
or replying with an error. Read more§fn release_pending_messages(&self) -> Vec<PendingOnionMessage<OffersMessage>>
fn release_pending_messages(&self) -> Vec<PendingOnionMessage<OffersMessage>>
Releases any
OffersMessage
s that need to be sent. Read more§impl OnionMessageHandler for IgnoringMessageHandler
impl OnionMessageHandler for IgnoringMessageHandler
§fn handle_onion_message(&self, _their_node_id: &PublicKey, _msg: &OnionMessage)
fn handle_onion_message(&self, _their_node_id: &PublicKey, _msg: &OnionMessage)
Handle an incoming
onion_message
message from the given peer.§fn next_onion_message_for_peer(
&self,
_peer_node_id: PublicKey,
) -> Option<OnionMessage>
fn next_onion_message_for_peer( &self, _peer_node_id: PublicKey, ) -> Option<OnionMessage>
Returns the next pending onion message for the peer with the given node id.
§fn peer_connected(
&self,
_their_node_id: &PublicKey,
_init: &Init,
_inbound: bool,
) -> Result<(), ()>
fn peer_connected( &self, _their_node_id: &PublicKey, _init: &Init, _inbound: bool, ) -> Result<(), ()>
Called when a connection is established with a peer. Can be used to track which peers
advertise onion message support and are online. Read more
§fn peer_disconnected(&self, _their_node_id: &PublicKey)
fn peer_disconnected(&self, _their_node_id: &PublicKey)
Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to
drop and refuse to forward onion messages to this peer.
§fn provided_node_features(&self) -> Features<NodeContext>
fn provided_node_features(&self) -> Features<NodeContext>
Gets the node feature flags which this handler itself supports. All available handlers are
queried similarly and their feature flags are OR’d together to form the
NodeFeatures
which are broadcasted in our NodeAnnouncement
message.§fn provided_init_features(
&self,
_their_node_id: &PublicKey,
) -> Features<InitContext>
fn provided_init_features( &self, _their_node_id: &PublicKey, ) -> Features<InitContext>
Gets the init feature flags which should be sent to the given peer. All available handlers
are queried similarly and their feature flags are OR’d together to form the
InitFeatures
which are sent in our Init
message. Read more§impl RoutingMessageHandler for IgnoringMessageHandler
impl RoutingMessageHandler for IgnoringMessageHandler
§fn handle_node_announcement(
&self,
_msg: &NodeAnnouncement,
) -> Result<bool, LightningError>
fn handle_node_announcement( &self, _msg: &NodeAnnouncement, ) -> Result<bool, LightningError>
Handle an incoming
node_announcement
message, returning true
if it should be forwarded on,
false
or returning an Err
otherwise.§fn handle_channel_announcement(
&self,
_msg: &ChannelAnnouncement,
) -> Result<bool, LightningError>
fn handle_channel_announcement( &self, _msg: &ChannelAnnouncement, ) -> Result<bool, LightningError>
Handle a
channel_announcement
message, returning true
if it should be forwarded on, false
or returning an Err
otherwise.§fn handle_channel_update(
&self,
_msg: &ChannelUpdate,
) -> Result<bool, LightningError>
fn handle_channel_update( &self, _msg: &ChannelUpdate, ) -> Result<bool, LightningError>
Handle an incoming
channel_update
message, returning true if it should be forwarded on,
false
or returning an Err
otherwise.§fn get_next_channel_announcement(
&self,
_starting_point: u64,
) -> Option<(ChannelAnnouncement, Option<ChannelUpdate>, Option<ChannelUpdate>)>
fn get_next_channel_announcement( &self, _starting_point: u64, ) -> Option<(ChannelAnnouncement, Option<ChannelUpdate>, Option<ChannelUpdate>)>
Gets channel announcements and updates required to dump our routing table to a remote node,
starting at the
short_channel_id
indicated by starting_point
and including announcements
for a single channel.§fn get_next_node_announcement(
&self,
_starting_point: Option<&NodeId>,
) -> Option<NodeAnnouncement>
fn get_next_node_announcement( &self, _starting_point: Option<&NodeId>, ) -> Option<NodeAnnouncement>
Gets a node announcement required to dump our routing table to a remote node, starting at
the node after the provided pubkey and including up to one announcement immediately
higher (as defined by
<PublicKey as Ord>::cmp
) than starting_point
.
If None
is provided for starting_point
, we start at the first node.§fn peer_connected(
&self,
_their_node_id: &PublicKey,
_init: &Init,
_inbound: bool,
) -> Result<(), ()>
fn peer_connected( &self, _their_node_id: &PublicKey, _init: &Init, _inbound: bool, ) -> Result<(), ()>
Called when a connection is established with a peer. This can be used to
perform routing table synchronization using a strategy defined by the
implementor. Read more
§fn handle_reply_channel_range(
&self,
_their_node_id: &PublicKey,
_msg: ReplyChannelRange,
) -> Result<(), LightningError>
fn handle_reply_channel_range( &self, _their_node_id: &PublicKey, _msg: ReplyChannelRange, ) -> Result<(), LightningError>
Handles the reply of a query we initiated to learn about channels
for a given range of blocks. We can expect to receive one or more
replies to a single query.
§fn handle_reply_short_channel_ids_end(
&self,
_their_node_id: &PublicKey,
_msg: ReplyShortChannelIdsEnd,
) -> Result<(), LightningError>
fn handle_reply_short_channel_ids_end( &self, _their_node_id: &PublicKey, _msg: ReplyShortChannelIdsEnd, ) -> Result<(), LightningError>
Handles the reply of a query we initiated asking for routing gossip
messages for a list of channels. We should receive this message when
a node has completed its best effort to send us the pertaining routing
gossip messages.
§fn handle_query_channel_range(
&self,
_their_node_id: &PublicKey,
_msg: QueryChannelRange,
) -> Result<(), LightningError>
fn handle_query_channel_range( &self, _their_node_id: &PublicKey, _msg: QueryChannelRange, ) -> Result<(), LightningError>
Handles when a peer asks us to send a list of
short_channel_id
s
for the requested range of blocks.§fn handle_query_short_channel_ids(
&self,
_their_node_id: &PublicKey,
_msg: QueryShortChannelIds,
) -> Result<(), LightningError>
fn handle_query_short_channel_ids( &self, _their_node_id: &PublicKey, _msg: QueryShortChannelIds, ) -> Result<(), LightningError>
Handles when a peer asks us to send routing gossip messages for a
list of
short_channel_id
s.§fn provided_node_features(&self) -> Features<NodeContext>
fn provided_node_features(&self) -> Features<NodeContext>
Gets the node feature flags which this handler itself supports. All available handlers are
queried similarly and their feature flags are OR’d together to form the
NodeFeatures
which are broadcasted in our NodeAnnouncement
message.§fn provided_init_features(
&self,
_their_node_id: &PublicKey,
) -> Features<InitContext>
fn provided_init_features( &self, _their_node_id: &PublicKey, ) -> Features<InitContext>
Gets the init feature flags which should be sent to the given peer. All available handlers
are queried similarly and their feature flags are OR’d together to form the
InitFeatures
which are sent in our Init
message. Read more§fn processing_queue_high(&self) -> bool
fn processing_queue_high(&self) -> bool
Indicates that there are a large number of
ChannelAnnouncement
(or other) messages
pending some async action. While there is no guarantee of the rate of future messages, the
caller should seek to reduce the rate of new gossip messages handled, especially
ChannelAnnouncement
s.Auto Trait Implementations§
impl Freeze for IgnoringMessageHandler
impl RefUnwindSafe for IgnoringMessageHandler
impl Send for IgnoringMessageHandler
impl Sync for IgnoringMessageHandler
impl Unpin for IgnoringMessageHandler
impl UnwindSafe for IgnoringMessageHandler
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
§impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
§type ScoreParams = <S as ScoreLookUp>::ScoreParams
type ScoreParams = <S as ScoreLookUp>::ScoreParams
A configurable type which should contain various passed-in parameters for configuring the scorer,
on a per-routefinding-call basis through to the scorer methods,
which are used to determine the parameters for the suitability of channels for use.
§fn channel_penalty_msat(
&self,
short_channel_id: u64,
source: &NodeId,
target: &NodeId,
usage: ChannelUsage,
score_params: &<T as ScoreLookUp>::ScoreParams,
) -> u64
fn channel_penalty_msat( &self, short_channel_id: u64, source: &NodeId, target: &NodeId, usage: ChannelUsage, score_params: &<T as ScoreLookUp>::ScoreParams, ) -> u64
Returns the fee in msats willing to be paid to avoid routing
send_amt_msat
through the
given channel in the direction from source
to target
. Read more§impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
§type ScoreParams = <S as ScoreLookUp>::ScoreParams
type ScoreParams = <S as ScoreLookUp>::ScoreParams
A configurable type which should contain various passed-in parameters for configuring the scorer,
on a per-routefinding-call basis through to the scorer methods,
which are used to determine the parameters for the suitability of channels for use.
§fn channel_penalty_msat(
&self,
candidate: &CandidateRouteHop<'_>,
usage: ChannelUsage,
score_params: &<T as ScoreLookUp>::ScoreParams,
) -> u64
fn channel_penalty_msat( &self, candidate: &CandidateRouteHop<'_>, usage: ChannelUsage, score_params: &<T as ScoreLookUp>::ScoreParams, ) -> u64
Returns the fee in msats willing to be paid to avoid routing
send_amt_msat
through the
given channel in the direction from source
to target
. Read more§impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
impl<S, T> ScoreLookUp for Twhere
S: ScoreLookUp,
T: Deref<Target = S>,
§type ScoreParams = <S as ScoreLookUp>::ScoreParams
type ScoreParams = <S as ScoreLookUp>::ScoreParams
A configurable type which should contain various passed-in parameters for configuring the scorer,
on a per-routefinding-call basis through to the scorer methods,
which are used to determine the parameters for the suitability of channels for use.
§fn channel_penalty_msat(
&self,
candidate: &CandidateRouteHop<'_>,
usage: ChannelUsage,
score_params: &<T as ScoreLookUp>::ScoreParams,
) -> u64
fn channel_penalty_msat( &self, candidate: &CandidateRouteHop<'_>, usage: ChannelUsage, score_params: &<T as ScoreLookUp>::ScoreParams, ) -> u64
Returns the fee in msats willing to be paid to avoid routing
send_amt_msat
through the
given channel in the direction from source
to target
. Read more