Rename variable
[rust-lightning] / lightning / src / ln / outbound_payment.rs
index b08a1e8a9bb1e3a565fcaf9c43492a9f22167c65..ac9eb74823ff15ac444209021399ab8443f6573f 100644 (file)
@@ -16,7 +16,8 @@ use bitcoin::secp256k1::{self, Secp256k1, SecretKey};
 use crate::sign::{EntropySource, NodeSigner, Recipient};
 use crate::events::{self, PaymentFailureReason};
 use crate::ln::types::{PaymentHash, PaymentPreimage, PaymentSecret};
-use crate::ln::channelmanager::{ChannelDetails, EventCompletionAction, HTLCSource, PaymentId};
+use crate::ln::channel_state::ChannelDetails;
+use crate::ln::channelmanager::{EventCompletionAction, HTLCSource, PaymentId};
 use crate::ln::onion_utils;
 use crate::ln::onion_utils::{DecodedOnionFailure, HTLCFailReason};
 use crate::offers::invoice::Bolt12Invoice;
@@ -70,7 +71,7 @@ pub(crate) enum PendingOutboundPayment {
                keysend_preimage: Option<PaymentPreimage>,
                custom_tlvs: Vec<(u64, Vec<u8>)>,
                pending_amt_msat: u64,
-               /// Used to track the fee paid. Only present if the payment was serialized on 0.0.103+.
+               /// Used to track the fee paid. Present iff the payment was serialized on 0.0.103+.
                pending_fee_msat: Option<u64>,
                /// The total payment amount across all paths, used to verify that a retry is not overpaying.
                total_msat: u64,
@@ -500,9 +501,9 @@ pub enum PaymentSendFailure {
        },
 }
 
-/// An error when attempting to pay a BOLT 12 invoice.
+/// An error when attempting to pay a [`Bolt12Invoice`].
 #[derive(Clone, Debug, PartialEq, Eq)]
-pub(super) enum Bolt12PaymentError {
+pub enum Bolt12PaymentError {
        /// The invoice was not requested.
        UnexpectedInvoice,
        /// Payment for an invoice with the corresponding [`PaymentId`] was already initiated.
@@ -806,9 +807,11 @@ impl OutboundPayments {
                        hash_map::Entry::Vacant(_) => return Err(Bolt12PaymentError::UnexpectedInvoice),
                };
 
-               let pay_params = PaymentParameters::from_bolt12_invoice(&invoice);
+               let payment_params = PaymentParameters::from_bolt12_invoice(&invoice);
                let amount_msat = invoice.amount_msats();
-               let mut route_params = RouteParameters::from_payment_params_and_value(pay_params, amount_msat);
+               let mut route_params = RouteParameters::from_payment_params_and_value(
+                       payment_params, amount_msat
+               );
                if let Some(max_fee_msat) = max_total_routing_fee_msat {
                        route_params.max_total_routing_fee_msat = Some(max_fee_msat);
                }
@@ -1850,7 +1853,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
 
 #[cfg(test)]
 mod tests {
-       use bitcoin::network::constants::Network;
+       use bitcoin::network::Network;
        use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
 
        use core::time::Duration;