Trait lightning::ln::msgs::ChannelMessageHandler
source · pub trait ChannelMessageHandler: MessageSendEventsProvider {
Show 22 methods
// Required methods
fn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel);
fn handle_accept_channel(
&self,
their_node_id: &PublicKey,
msg: &AcceptChannel
);
fn handle_funding_created(
&self,
their_node_id: &PublicKey,
msg: &FundingCreated
);
fn handle_funding_signed(
&self,
their_node_id: &PublicKey,
msg: &FundingSigned
);
fn handle_channel_ready(&self, their_node_id: &PublicKey, msg: &ChannelReady);
fn handle_shutdown(&self, their_node_id: &PublicKey, msg: &Shutdown);
fn handle_closing_signed(
&self,
their_node_id: &PublicKey,
msg: &ClosingSigned
);
fn handle_update_add_htlc(
&self,
their_node_id: &PublicKey,
msg: &UpdateAddHTLC
);
fn handle_update_fulfill_htlc(
&self,
their_node_id: &PublicKey,
msg: &UpdateFulfillHTLC
);
fn handle_update_fail_htlc(
&self,
their_node_id: &PublicKey,
msg: &UpdateFailHTLC
);
fn handle_update_fail_malformed_htlc(
&self,
their_node_id: &PublicKey,
msg: &UpdateFailMalformedHTLC
);
fn handle_commitment_signed(
&self,
their_node_id: &PublicKey,
msg: &CommitmentSigned
);
fn handle_revoke_and_ack(&self, their_node_id: &PublicKey, msg: &RevokeAndACK);
fn handle_update_fee(&self, their_node_id: &PublicKey, msg: &UpdateFee);
fn handle_announcement_signatures(
&self,
their_node_id: &PublicKey,
msg: &AnnouncementSignatures
);
fn peer_disconnected(&self, their_node_id: &PublicKey);
fn peer_connected(
&self,
their_node_id: &PublicKey,
msg: &Init,
inbound: bool
) -> Result<(), ()>;
fn handle_channel_reestablish(
&self,
their_node_id: &PublicKey,
msg: &ChannelReestablish
);
fn handle_channel_update(
&self,
their_node_id: &PublicKey,
msg: &ChannelUpdate
);
fn handle_error(&self, their_node_id: &PublicKey, msg: &ErrorMessage);
fn provided_node_features(&self) -> NodeFeatures;
fn provided_init_features(&self, their_node_id: &PublicKey) -> InitFeatures;
}
Expand description
A trait to describe an object which can receive channel messages.
Messages MAY be called in parallel when they originate from different their_node_ids
, however
they MUST NOT be called in parallel when the two calls have the same their_node_id
.
Required Methods§
sourcefn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel)
fn handle_open_channel(&self, their_node_id: &PublicKey, msg: &OpenChannel)
Handle an incoming open_channel
message from the given peer.
sourcefn handle_accept_channel(&self, their_node_id: &PublicKey, msg: &AcceptChannel)
fn handle_accept_channel(&self, their_node_id: &PublicKey, msg: &AcceptChannel)
Handle an incoming accept_channel
message from the given peer.
sourcefn handle_funding_created(&self, their_node_id: &PublicKey, msg: &FundingCreated)
fn handle_funding_created(&self, their_node_id: &PublicKey, msg: &FundingCreated)
Handle an incoming funding_created
message from the given peer.
sourcefn handle_funding_signed(&self, their_node_id: &PublicKey, msg: &FundingSigned)
fn handle_funding_signed(&self, their_node_id: &PublicKey, msg: &FundingSigned)
Handle an incoming funding_signed
message from the given peer.
sourcefn handle_channel_ready(&self, their_node_id: &PublicKey, msg: &ChannelReady)
fn handle_channel_ready(&self, their_node_id: &PublicKey, msg: &ChannelReady)
Handle an incoming channel_ready
message from the given peer.
sourcefn handle_shutdown(&self, their_node_id: &PublicKey, msg: &Shutdown)
fn handle_shutdown(&self, their_node_id: &PublicKey, msg: &Shutdown)
Handle an incoming shutdown
message from the given peer.
sourcefn handle_closing_signed(&self, their_node_id: &PublicKey, msg: &ClosingSigned)
fn handle_closing_signed(&self, their_node_id: &PublicKey, msg: &ClosingSigned)
Handle an incoming closing_signed
message from the given peer.
sourcefn handle_update_add_htlc(&self, their_node_id: &PublicKey, msg: &UpdateAddHTLC)
fn handle_update_add_htlc(&self, their_node_id: &PublicKey, msg: &UpdateAddHTLC)
Handle an incoming update_add_htlc
message from the given peer.
sourcefn handle_update_fulfill_htlc(
&self,
their_node_id: &PublicKey,
msg: &UpdateFulfillHTLC
)
fn handle_update_fulfill_htlc( &self, their_node_id: &PublicKey, msg: &UpdateFulfillHTLC )
Handle an incoming update_fulfill_htlc
message from the given peer.
sourcefn handle_update_fail_htlc(&self, their_node_id: &PublicKey, msg: &UpdateFailHTLC)
fn handle_update_fail_htlc(&self, their_node_id: &PublicKey, msg: &UpdateFailHTLC)
Handle an incoming update_fail_htlc
message from the given peer.
sourcefn handle_update_fail_malformed_htlc(
&self,
their_node_id: &PublicKey,
msg: &UpdateFailMalformedHTLC
)
fn handle_update_fail_malformed_htlc( &self, their_node_id: &PublicKey, msg: &UpdateFailMalformedHTLC )
Handle an incoming update_fail_malformed_htlc
message from the given peer.
sourcefn handle_commitment_signed(
&self,
their_node_id: &PublicKey,
msg: &CommitmentSigned
)
fn handle_commitment_signed( &self, their_node_id: &PublicKey, msg: &CommitmentSigned )
Handle an incoming commitment_signed
message from the given peer.
sourcefn handle_revoke_and_ack(&self, their_node_id: &PublicKey, msg: &RevokeAndACK)
fn handle_revoke_and_ack(&self, their_node_id: &PublicKey, msg: &RevokeAndACK)
Handle an incoming revoke_and_ack
message from the given peer.
sourcefn handle_update_fee(&self, their_node_id: &PublicKey, msg: &UpdateFee)
fn handle_update_fee(&self, their_node_id: &PublicKey, msg: &UpdateFee)
Handle an incoming update_fee
message from the given peer.
sourcefn handle_announcement_signatures(
&self,
their_node_id: &PublicKey,
msg: &AnnouncementSignatures
)
fn handle_announcement_signatures( &self, their_node_id: &PublicKey, msg: &AnnouncementSignatures )
Handle an incoming announcement_signatures
message from the given peer.
sourcefn 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.
sourcefn peer_connected(
&self,
their_node_id: &PublicKey,
msg: &Init,
inbound: bool
) -> Result<(), ()>
fn peer_connected( &self, their_node_id: &PublicKey, msg: &Init, inbound: bool ) -> Result<(), ()>
Handle a peer reconnecting, possibly generating channel_reestablish
message(s).
May return an Err(())
if the features the peer supports are not sufficient to communicate
with us. Implementors should be somewhat conservative about doing so, however, as other
message handlers may still wish to communicate with this peer.
sourcefn handle_channel_reestablish(
&self,
their_node_id: &PublicKey,
msg: &ChannelReestablish
)
fn handle_channel_reestablish( &self, their_node_id: &PublicKey, msg: &ChannelReestablish )
Handle an incoming channel_reestablish
message from the given peer.
sourcefn handle_channel_update(&self, their_node_id: &PublicKey, msg: &ChannelUpdate)
fn handle_channel_update(&self, their_node_id: &PublicKey, msg: &ChannelUpdate)
Handle an incoming channel_update
message from the given peer.
sourcefn handle_error(&self, their_node_id: &PublicKey, msg: &ErrorMessage)
fn handle_error(&self, their_node_id: &PublicKey, msg: &ErrorMessage)
Handle an incoming error
message from the given peer.
sourcefn provided_node_features(&self) -> NodeFeatures
fn provided_node_features(&self) -> NodeFeatures
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.
sourcefn provided_init_features(&self, their_node_id: &PublicKey) -> InitFeatures
fn provided_init_features(&self, their_node_id: &PublicKey) -> InitFeatures
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.
Note that this method is called before Self::peer_connected
.