+// This file is Copyright its original authors, visible in version control
+// history.
+//
+// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
+// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// You may not use this file except in accordance with one or both of these
+// licenses.
+
//! Events are returned from various bits in the library which indicate some action must be taken
//! by the client.
//!
use bitcoin::blockdata::script::Script;
-use secp256k1::key::PublicKey;
+use bitcoin::secp256k1::key::PublicKey;
use std::time::Duration;
/// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
/// them directly as they don't round-trip exactly (for example FundingGenerationReady is never
/// written as it makes no sense to respond to it after reconnecting to peers).
+#[derive(Clone, Debug)]
pub enum Event {
/// Used to indicate that the client should generate a funding transaction with the given
/// parameters and then call ChannelManager::funding_transaction_generated.
},
/// Indicates we've received money! Just gotta dig out that payment preimage and feed it to
/// ChannelManager::claim_funds to get it....
- /// Note that if the preimage is not known or the amount paid is incorrect, you must call
- /// ChannelManager::fail_htlc_backwards to free up resources for this HTLC.
+ /// Note that if the preimage is not known or the amount paid is incorrect, you should call
+ /// ChannelManager::fail_htlc_backwards to free up resources for this HTLC and avoid
+ /// network congestion.
/// The amount paid should be considered 'incorrect' when it is less than or more than twice
/// the amount expected.
+ /// If you fail to call either ChannelManager::claim_funds or
+ /// ChannelManager::fail_htlc_backwards within the HTLC's timeout, the HTLC will be
+ /// automatically failed.
PaymentReceived {
/// The hash for which the preimage should be handed to the ChannelManager.
payment_hash: PaymentHash,
/// An event generated by ChannelManager which indicates a message should be sent to a peer (or
/// broadcast to most peers).
/// These events are handled by PeerManager::process_events if you are using a PeerManager.
-#[derive(Clone)]
+#[derive(Clone, Debug)]
pub enum MessageSendEvent {
/// Used to indicate that we've accepted a channel open and should send the accept_channel
/// message provided to the given peer.
action: msgs::ErrorAction
},
/// When a payment fails we may receive updates back from the hop where it failed. In such
- /// cases this event is generated so that we can inform the router of this information.
+ /// cases this event is generated so that we can inform the network graph of this information.
PaymentFailureNetworkUpdate {
- /// The channel/node update which should be sent to router
+ /// The channel/node update which should be sent to NetGraphMsgHandler
update: msgs::HTLCFailChannelUpdate,
+ },
+ /// Query a peer for channels with funding transaction UTXOs in a block range.
+ SendChannelRangeQuery {
+ /// The node_id of this message recipient
+ node_id: PublicKey,
+ /// The query_channel_range which should be sent.
+ msg: msgs::QueryChannelRange,
+ },
+ /// Request routing gossip messages from a peer for a list of channels identified by
+ /// their short_channel_ids.
+ SendShortIdsQuery {
+ /// The node_id of this message recipient
+ node_id: PublicKey,
+ /// The query_short_channel_ids which should be sent.
+ msg: msgs::QueryShortChannelIds,
+ },
+ /// Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
+ /// emitted during processing of the query.
+ SendReplyChannelRange {
+ /// The node_id of this message recipient
+ node_id: PublicKey,
+ /// The reply_channel_range which should be sent.
+ msg: msgs::ReplyChannelRange,
}
}