use bitcoin::script::Builder;
use bitcoin::transaction::TxOut;
-use lightning::blinded_path::payment::BlindedPaymentPath;
+use lightning::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath};
use lightning::blinded_path::BlindedHop;
use lightning::chain::transaction::OutPoint;
use lightning::ln::channel_state::{ChannelCounterparty, ChannelDetails, ChannelShutdownState};
use lightning::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
use lightning::ln::msgs;
use lightning::ln::types::ChannelId;
-use lightning::offers::invoice::BlindedPayInfo;
use lightning::routing::gossip::{NetworkGraph, RoutingFees};
use lightning::routing::router::{
find_route, PaymentParameters, RouteHint, RouteHintHop, RouteParameters,
use crate::ln::features::BlindedHopFeatures;
use crate::ln::msgs::DecodeError;
use crate::ln::onion_utils;
-use crate::offers::invoice::BlindedPayInfo;
use crate::offers::invoice_request::InvoiceRequestFields;
use crate::offers::offer::OfferId;
use crate::routing::gossip::{NodeId, ReadOnlyNetworkGraph};
#[allow(unused_imports)]
use crate::prelude::*;
+/// Information needed to route a payment across a [`BlindedPaymentPath`].
+#[derive(Clone, Debug, Hash, Eq, PartialEq)]
+pub struct BlindedPayInfo {
+ /// Base fee charged (in millisatoshi) for the entire blinded path.
+ pub fee_base_msat: u32,
+
+ /// Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
+ /// (i.e., 10,000 is 1%).
+ pub fee_proportional_millionths: u32,
+
+ /// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
+ /// path.
+ pub cltv_expiry_delta: u16,
+
+ /// The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
+ /// blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
+ /// seen by the recipient.
+ pub htlc_minimum_msat: u64,
+
+ /// The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
+ /// blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
+ /// seen by the recipient.
+ pub htlc_maximum_msat: u64,
+
+ /// Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
+ /// onion payload.
+ pub features: BlindedHopFeatures,
+}
+
+impl_writeable!(BlindedPayInfo, {
+ fee_base_msat,
+ fee_proportional_millionths,
+ cltv_expiry_delta,
+ htlc_minimum_msat,
+ htlc_maximum_msat,
+ features
+});
+
/// A blinded path to be used for sending or receiving a payment, hiding the identity of the
/// recipient.
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
use bitcoin::secp256k1::{Secp256k1, PublicKey};
use crate::blinded_path::BlindedHop;
-use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints, PaymentContext, ReceiveTlvs};
+use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath, PaymentConstraints, PaymentContext, ReceiveTlvs};
use crate::events::{Event, MessageSendEventsProvider};
use crate::ln::PaymentSecret;
use crate::ln::blinded_payment_tests::get_blinded_route_parameters;
use crate::ln::onion_utils;
use crate::ln::onion_utils::MIN_FINAL_VALUE_ESTIMATE_WITH_OVERPAY;
use crate::ln::outbound_payment::{RecipientOnionFields, Retry, RetryableSendFailure};
-use crate::offers::invoice::BlindedPayInfo;
use crate::prelude::*;
use crate::routing::router::{DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA, PaymentParameters, RouteParameters};
use crate::util::errors::APIError;
//! use lightning::util::ser::Writeable;
//!
//! # use lightning::ln::types::PaymentHash;
-//! # use lightning::offers::invoice::{BlindedPayInfo, ExplicitSigningPubkey, InvoiceBuilder};
-//! # use lightning::blinded_path::payment::BlindedPaymentPath;
+//! # use lightning::offers::invoice::{ExplicitSigningPubkey, InvoiceBuilder};
+//! # use lightning::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath};
//! #
//! # fn create_payment_paths() -> Vec<BlindedPaymentPath> { unimplemented!() }
//! # fn create_payment_hash() -> PaymentHash { unimplemented!() }
use crate::io;
use crate::blinded_path::BlindedPath;
use crate::blinded_path::message::BlindedMessagePath;
-use crate::blinded_path::payment::BlindedPaymentPath;
+use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath};
use crate::ln::types::PaymentHash;
use crate::ln::channelmanager::PaymentId;
-use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures};
+use crate::ln::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures};
use crate::ln::inbound_payment::{ExpandedKey, IV_LEN};
use crate::ln::msgs::DecodeError;
use crate::offers::invoice_macros::{invoice_accessors_common, invoice_builder_methods_common};
for<'r> fn(&'r BlindedPaymentPath) -> &'r BlindedPayInfo,
>;
-/// Information needed to route a payment across a [`BlindedPaymentPath`].
-#[derive(Clone, Debug, Hash, Eq, PartialEq)]
-pub struct BlindedPayInfo {
- /// Base fee charged (in millisatoshi) for the entire blinded path.
- pub fee_base_msat: u32,
-
- /// Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
- /// (i.e., 10,000 is 1%).
- pub fee_proportional_millionths: u32,
-
- /// Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
- /// path.
- pub cltv_expiry_delta: u16,
-
- /// The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
- /// blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
- /// seen by the recipient.
- pub htlc_minimum_msat: u64,
-
- /// The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
- /// blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
- /// seen by the recipient.
- pub htlc_maximum_msat: u64,
-
- /// Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
- /// onion payload.
- pub features: BlindedHopFeatures,
-}
-
-impl_writeable!(BlindedPayInfo, {
- fee_base_msat,
- fee_proportional_millionths,
- cltv_expiry_delta,
- htlc_minimum_msat,
- htlc_maximum_msat,
- features
-});
-
/// Wire representation for an on-chain fallback address.
#[derive(Clone, Debug, PartialEq)]
pub(super) struct FallbackAddress {
use core::time::Duration;
use crate::blinded_path::BlindedHop;
-use crate::blinded_path::payment::BlindedPaymentPath;
+use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath};
use crate::sign::EntropySource;
use crate::ln::types::PaymentHash;
use crate::ln::features::BlindedHopFeatures;
-use crate::offers::invoice::BlindedPayInfo;
use crate::offers::merkle::TaggedHash;
#[allow(unused_imports)]
///
/// This is not exported to bindings users as lifetimes are not expressible in most languages.
///
- /// [`BlindedPayInfo`]: crate::offers::invoice::BlindedPayInfo
+ /// [`BlindedPayInfo`]: crate::blinded_path::payment::BlindedPayInfo
pub hint: &'a BlindedPaymentPath,
/// Index of the hint in the original list of blinded hints.
///
/// This primarily exists to track that we need to included a blinded path at the end of our
/// [`Route`], even though it doesn't actually add an additional hop in the payment.
///
- /// [`BlindedPayInfo`]: crate::offers::invoice::BlindedPayInfo
+ /// [`BlindedPayInfo`]: crate::blinded_path::payment::BlindedPayInfo
OneHopBlinded(OneHopBlindedPathCandidate<'a>),
}
#[cfg(test)]
mod tests {
use crate::blinded_path::BlindedHop;
- use crate::blinded_path::payment::BlindedPaymentPath;
+ use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath};
use crate::routing::gossip::{NetworkGraph, P2PGossipSync, NodeId, EffectiveCapacity};
use crate::routing::utxo::UtxoResult;
use crate::routing::router::{get_route, build_route_from_hops_internal, add_random_cltv_offset, default_node_features,
use crate::ln::features::{BlindedHopFeatures, ChannelFeatures, InitFeatures, NodeFeatures};
use crate::ln::msgs::{ErrorAction, LightningError, UnsignedChannelUpdate, MAX_VALUE_MSAT};
use crate::ln::channelmanager;
- use crate::offers::invoice::BlindedPayInfo;
use crate::util::config::UserConfig;
use crate::util::test_utils as ln_test_utils;
use crate::crypto::chacha20::ChaCha20;