#[cfg(anchors)]
pub use bump_transaction::BumpTransactionEvent;
-use crate::chain::keysinterface::SpendableOutputDescriptor;
+use crate::sign::SpendableOutputDescriptor;
use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields};
use crate::ln::channel::FUNDING_CONF_DEADLINE_BLOCKS;
use crate::ln::features::ChannelTypeFeatures;
/// Be careful about printing the peer_msg, a well-crafted message could exploit
/// a security vulnerability in the terminal emulator or the logging subsystem.
/// To be safe, use `Display` on `UntrustedString`
- ///
+ ///
/// [`UntrustedString`]: crate::util::string::UntrustedString
peer_msg: UntrustedString,
},
/// This field will always be filled in when the event was generated by LDK versions
/// 0.0.113 and above.
///
- /// [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
+ /// [phantom nodes]: crate::sign::PhantomKeysManager
receiver_node_id: Option<PublicKey>,
/// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
/// not stop you from registering duplicate payment hashes for inbound payments.
///
/// Payments received on LDK versions prior to 0.0.115 will have this field unset.
onion_fields: Option<RecipientOnionFields>,
- /// The value, in thousandths of a satoshi, that this payment is for.
+ /// The value, in thousandths of a satoshi, that this payment is claimable for.
+ ///
+ /// May be less than the invoice amount if [`ChannelConfig::accept_underpaying_htlcs`] is set
+ /// and the previous hop took an extra fee.
+ ///
+ /// # Note
+ /// If [`ChannelConfig::accept_underpaying_htlcs`] is set and you claim without verifying this
+ /// field, you may lose money!
+ ///
+ /// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
amount_msat: u64,
+ /// The value, in thousands of a satoshi, that was skimmed off of this payment as an extra fee
+ /// taken by our channel counterparty.
+ ///
+ /// Will always be 0 unless [`ChannelConfig::accept_underpaying_htlcs`] is set.
+ ///
+ /// [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
+ counterparty_skimmed_fee_msat: u64,
/// Information for claiming this received payment, based on whether the purpose of the
/// payment is to pay an invoice or to send a spontaneous payment.
purpose: PaymentPurpose,
/// This field will always be filled in when the event was generated by LDK versions
/// 0.0.113 and above.
///
- /// [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
+ /// [phantom nodes]: crate::sign::PhantomKeysManager
receiver_node_id: Option<PublicKey>,
/// The payment hash of the claimed payment. Note that LDK will not stop you from
/// registering duplicate payment hashes for inbound payments.
payment_id: PaymentId,
/// The hash that was given to [`ChannelManager::send_payment`].
///
+ /// This will be `Some` for all payments which completed on LDK 0.0.104 or later.
+ ///
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
payment_hash: Option<PaymentHash>,
/// The payment path that was successful.
PaymentPathFailed {
/// The `payment_id` passed to [`ChannelManager::send_payment`].
///
+ /// This will be `Some` for all payment paths which failed on LDK 0.0.103 or later.
+ ///
/// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
/// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
payment_id: Option<PaymentId>,
inbound_amount_msat: u64,
/// How many msats the payer intended to route to the next node. Depending on the reason you are
/// intercepting this payment, you might take a fee by forwarding less than this amount.
+ /// Forwarding less than this amount may break compatibility with LDK versions prior to 0.0.116.
///
/// Note that LDK will NOT check that expected fees were factored into this value. You MUST
/// check that whatever fee you want has been included here or subtract it as required. Further,
// We never write out FundingGenerationReady events as, upon disconnection, peers
// drop any channels which have not yet exchanged funding_signed.
},
- &Event::PaymentClaimable { ref payment_hash, ref amount_msat, ref purpose,
- ref receiver_node_id, ref via_channel_id, ref via_user_channel_id,
+ &Event::PaymentClaimable { ref payment_hash, ref amount_msat, counterparty_skimmed_fee_msat,
+ ref purpose, ref receiver_node_id, ref via_channel_id, ref via_user_channel_id,
ref claim_deadline, ref onion_fields
} => {
1u8.write(writer)?;
payment_preimage = Some(*preimage);
}
}
+ let skimmed_fee_opt = if counterparty_skimmed_fee_msat == 0 { None }
+ else { Some(counterparty_skimmed_fee_msat) };
write_tlv_fields!(writer, {
(0, payment_hash, required),
(1, receiver_node_id, option),
(7, claim_deadline, option),
(8, payment_preimage, option),
(9, onion_fields, option),
+ (10, skimmed_fee_opt, option),
});
},
&Event::PaymentSent { ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat } => {
let mut payment_preimage = None;
let mut payment_secret = None;
let mut amount_msat = 0;
+ let mut counterparty_skimmed_fee_msat_opt = None;
let mut receiver_node_id = None;
let mut _user_payment_id = None::<u64>; // For compatibility with 0.0.103 and earlier
let mut via_channel_id = None;
(7, claim_deadline, option),
(8, payment_preimage, option),
(9, onion_fields, option),
+ (10, counterparty_skimmed_fee_msat_opt, option),
});
let purpose = match payment_secret {
Some(secret) => PaymentPurpose::InvoicePayment {
receiver_node_id,
payment_hash,
amount_msat,
+ counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat_opt.unwrap_or(0),
purpose,
via_channel_id,
via_user_channel_id,
/// The message which should be sent.
msg: msgs::AcceptChannel,
},
+ /// Used to indicate that we've accepted a V2 channel open and should send the accept_channel2
+ /// message provided to the given peer.
+ SendAcceptChannelV2 {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::AcceptChannelV2,
+ },
/// Used to indicate that we've initiated a channel open and should send the open_channel
/// message provided to the given peer.
SendOpenChannel {
/// The message which should be sent.
msg: msgs::OpenChannel,
},
+ /// Used to indicate that we've initiated a V2 channel open and should send the open_channel2
+ /// message provided to the given peer.
+ SendOpenChannelV2 {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::OpenChannelV2,
+ },
/// Used to indicate that a funding_created message should be sent to the peer with the given node_id.
SendFundingCreated {
/// The node_id of the node which should receive this message
/// The message which should be sent.
msg: msgs::FundingSigned,
},
+ /// Used to indicate that a tx_add_input message should be sent to the peer with the given node_id.
+ SendTxAddInput {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxAddInput,
+ },
+ /// Used to indicate that a tx_add_output message should be sent to the peer with the given node_id.
+ SendTxAddOutput {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxAddOutput,
+ },
+ /// Used to indicate that a tx_remove_input message should be sent to the peer with the given node_id.
+ SendTxRemoveInput {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxRemoveInput,
+ },
+ /// Used to indicate that a tx_remove_output message should be sent to the peer with the given node_id.
+ SendTxRemoveOutput {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxRemoveOutput,
+ },
+ /// Used to indicate that a tx_complete message should be sent to the peer with the given node_id.
+ SendTxComplete {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxComplete,
+ },
+ /// Used to indicate that a tx_signatures message should be sent to the peer with the given node_id.
+ SendTxSignatures {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxSignatures,
+ },
+ /// Used to indicate that a tx_init_rbf message should be sent to the peer with the given node_id.
+ SendTxInitRbf {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxInitRbf,
+ },
+ /// Used to indicate that a tx_ack_rbf message should be sent to the peer with the given node_id.
+ SendTxAckRbf {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxAckRbf,
+ },
+ /// Used to indicate that a tx_abort message should be sent to the peer with the given node_id.
+ SendTxAbort {
+ /// The node_id of the node which should receive this message
+ node_id: PublicKey,
+ /// The message which should be sent.
+ msg: msgs::TxAddInput,
+ },
/// Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
SendChannelReady {
/// The node_id of the node which should receive these message(s)