From: Matt Corallo Date: Sat, 12 Oct 2024 21:59:54 +0000 (+0000) Subject: Drop the `Payment{Hash,Preimage,Secret}` re-exports in `lightning` X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=50b5a6efa7bb68f36df8ea32dc4e147e4c48c459;p=rust-lightning Drop the `Payment{Hash,Preimage,Secret}` re-exports in `lightning` These re-exports were deprecated in 0.0.124 in favor of the `lightning::types::payment::*` paths, which we use here. --- diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index 9616b6f54..f897ba6e0 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -55,7 +55,7 @@ use lightning::ln::msgs::{ self, ChannelMessageHandler, CommitmentUpdate, DecodeError, Init, UpdateAddHTLC, }; use lightning::ln::script::ShutdownScript; -use lightning::ln::types::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; +use lightning::ln::types::ChannelId; use lightning::offers::invoice::UnsignedBolt12Invoice; use lightning::offers::invoice_request::UnsignedInvoiceRequest; use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath}; @@ -63,6 +63,7 @@ use lightning::routing::router::{InFlightHtlcs, Path, Route, RouteHop, RoutePara use lightning::sign::{ EntropySource, InMemorySigner, KeyMaterial, NodeSigner, Recipient, SignerProvider, }; +use lightning::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; use lightning::util::config::UserConfig; use lightning::util::errors::APIError; use lightning::util::hash_tables::*; diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 8ce17c93d..59f1275a6 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -48,7 +48,7 @@ use lightning::ln::peer_handler::{ IgnoringMessageHandler, MessageHandler, PeerManager, SocketDescriptor, }; use lightning::ln::script::ShutdownScript; -use lightning::ln::types::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; +use lightning::ln::types::ChannelId; use lightning::offers::invoice::UnsignedBolt12Invoice; use lightning::offers::invoice_request::UnsignedInvoiceRequest; use lightning::onion_message::messenger::{Destination, MessageRouter, OnionMessagePath}; @@ -60,6 +60,7 @@ use lightning::routing::utxo::UtxoLookup; use lightning::sign::{ EntropySource, InMemorySigner, KeyMaterial, NodeSigner, Recipient, SignerProvider, }; +use lightning::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; use lightning::util::config::{ChannelConfig, UserConfig}; use lightning::util::errors::APIError; use lightning::util::hash_tables::*; diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs index 2bebb0233..aa3c006ab 100644 --- a/fuzz/src/invoice_request_deser.rs +++ b/fuzz/src/invoice_request_deser.rs @@ -15,14 +15,13 @@ use lightning::blinded_path::payment::{ PaymentForwardNode, PaymentRelay, ReceiveTlvs, }; use lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA; -use lightning::ln::types::PaymentSecret; -use lightning::ln::PaymentHash; use lightning::offers::invoice::UnsignedBolt12Invoice; use lightning::offers::invoice_request::{InvoiceRequest, InvoiceRequestFields}; use lightning::offers::offer::OfferId; use lightning::offers::parse::Bolt12SemanticError; use lightning::sign::EntropySource; use lightning::types::features::BlindedHopFeatures; +use lightning::types::payment::{PaymentHash, PaymentSecret}; use lightning::util::ser::Writeable; use lightning::util::string::UntrustedString; diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs index 148a59fdd..d8d9881ef 100644 --- a/fuzz/src/refund_deser.rs +++ b/fuzz/src/refund_deser.rs @@ -15,13 +15,12 @@ use lightning::blinded_path::payment::{ PaymentForwardNode, PaymentRelay, ReceiveTlvs, }; use lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA; -use lightning::ln::types::PaymentSecret; -use lightning::ln::PaymentHash; use lightning::offers::invoice::UnsignedBolt12Invoice; use lightning::offers::parse::Bolt12SemanticError; use lightning::offers::refund::Refund; use lightning::sign::EntropySource; use lightning::types::features::BlindedHopFeatures; +use lightning::types::payment::{PaymentHash, PaymentSecret}; use lightning::util::ser::Writeable; #[inline] diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index cea975fb0..66cd0260d 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -1092,13 +1092,14 @@ mod tests { use lightning::ln::peer_handler::{ IgnoringMessageHandler, MessageHandler, PeerManager, SocketDescriptor, }; - use lightning::ln::types::{ChannelId, PaymentHash}; + use lightning::ln::types::ChannelId; use lightning::onion_message::messenger::{DefaultMessageRouter, OnionMessenger}; use lightning::routing::gossip::{NetworkGraph, P2PGossipSync}; use lightning::routing::router::{CandidateRouteHop, DefaultRouter, Path, RouteHop}; use lightning::routing::scoring::{ChannelUsage, LockableScore, ScoreLookUp, ScoreUpdate}; use lightning::sign::{ChangeDestinationSource, InMemorySigner, KeysManager}; use lightning::types::features::{ChannelFeatures, NodeFeatures}; + use lightning::types::payment::PaymentHash; use lightning::util::config::UserConfig; use lightning::util::persist::{ KVStore, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE, diff --git a/lightning/src/blinded_path/message.rs b/lightning/src/blinded_path/message.rs index 2cad33887..4d96434dd 100644 --- a/lightning/src/blinded_path/message.rs +++ b/lightning/src/blinded_path/message.rs @@ -22,7 +22,8 @@ use crate::io; use crate::io::Cursor; use crate::ln::channelmanager::PaymentId; use crate::ln::msgs::DecodeError; -use crate::ln::{PaymentHash, onion_utils}; +use crate::ln::onion_utils; +use crate::types::payment::PaymentHash; use crate::offers::nonce::Nonce; use crate::onion_message::packet::ControlTlvs; use crate::routing::gossip::{NodeId, ReadOnlyNetworkGraph}; diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs index 69ee5ce4b..62ce7dec1 100644 --- a/lightning/src/blinded_path/payment.rs +++ b/lightning/src/blinded_path/payment.rs @@ -16,7 +16,7 @@ use crate::blinded_path::utils; use crate::crypto::streams::ChaChaPolyReadAdapter; use crate::io; use crate::io::Cursor; -use crate::ln::types::PaymentSecret; +use crate::types::payment::PaymentSecret; use crate::ln::channel_state::CounterpartyForwardingInfo; use crate::types::features::BlindedHopFeatures; use crate::ln::msgs::DecodeError; @@ -632,7 +632,7 @@ impl_writeable_tlv_based!(Bolt12RefundContext, {}); mod tests { use bitcoin::secp256k1::PublicKey; use crate::blinded_path::payment::{PaymentForwardNode, ForwardTlvs, ReceiveTlvs, PaymentConstraints, PaymentContext, PaymentRelay}; - use crate::ln::types::PaymentSecret; + use crate::types::payment::PaymentSecret; use crate::types::features::BlindedHopFeatures; use crate::ln::functional_test_utils::TEST_FINAL_CLTV; diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index b0ac1a34c..7449d1538 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -33,7 +33,8 @@ use bitcoin::ecdsa::Signature as BitcoinSignature; use bitcoin::secp256k1::{self, SecretKey, PublicKey, Secp256k1, ecdsa::Signature}; use crate::ln::channel::INITIAL_COMMITMENT_NUMBER; -use crate::ln::types::{PaymentHash, PaymentPreimage, ChannelId}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::ln::msgs::DecodeError; use crate::ln::channel_keys::{DelayedPaymentKey, DelayedPaymentBasepoint, HtlcBasepoint, HtlcKey, RevocationKey, RevocationBasepoint}; use crate::ln::chan_utils::{self,CommitmentTransaction, CounterpartyCommitmentSecrets, HTLCOutputInCommitment, HTLCClaim, ChannelTransactionParameters, HolderCommitmentTransaction, TxCreationKeys}; @@ -5006,7 +5007,8 @@ mod tests { use crate::chain::package::{weight_offered_htlc, weight_received_htlc, weight_revoked_offered_htlc, weight_revoked_received_htlc, WEIGHT_REVOKED_OUTPUT}; use crate::chain::transaction::OutPoint; use crate::sign::InMemorySigner; - use crate::ln::types::{PaymentPreimage, PaymentHash, ChannelId}; + use crate::ln::types::ChannelId; + use crate::types::payment::{PaymentPreimage, PaymentHash}; use crate::ln::channel_keys::{DelayedPaymentBasepoint, DelayedPaymentKey, HtlcBasepoint, RevocationBasepoint, RevocationKey}; use crate::ln::chan_utils::{self,HTLCOutputInCommitment, ChannelPublicKeys, ChannelTransactionParameters, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters}; use crate::ln::channelmanager::{PaymentSendFailure, PaymentId, RecipientOnionFields}; diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index 56b34818a..fb842a39d 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -27,7 +27,7 @@ use bitcoin::secp256k1; use crate::chain::chaininterface::{ConfirmationTarget, compute_feerate_sat_per_1000_weight}; use crate::sign::{ChannelDerivationParameters, HTLCDescriptor, ChannelSigner, EntropySource, SignerProvider, ecdsa::EcdsaChannelSigner}; use crate::ln::msgs::DecodeError; -use crate::ln::types::PaymentPreimage; +use crate::types::payment::PaymentPreimage; use crate::ln::chan_utils::{self, ChannelTransactionParameters, HTLCOutputInCommitment, HolderCommitmentTransaction}; use crate::chain::ClaimId; use crate::chain::chaininterface::{FeeEstimator, BroadcasterInterface, LowerBoundedFeeEstimator}; diff --git a/lightning/src/chain/package.rs b/lightning/src/chain/package.rs index 1ab124b8c..1b96acd67 100644 --- a/lightning/src/chain/package.rs +++ b/lightning/src/chain/package.rs @@ -24,7 +24,7 @@ use bitcoin::secp256k1::{SecretKey,PublicKey}; use bitcoin::sighash::EcdsaSighashType; use bitcoin::transaction::Version; -use crate::ln::types::PaymentPreimage; +use crate::types::payment::PaymentPreimage; use crate::ln::chan_utils::{self, TxCreationKeys, HTLCOutputInCommitment}; use crate::types::features::ChannelTypeFeatures; use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint}; @@ -1199,7 +1199,7 @@ mod tests { use crate::chain::package::{CounterpartyOfferedHTLCOutput, CounterpartyReceivedHTLCOutput, HolderHTLCOutput, PackageTemplate, PackageSolvingData, RevokedOutput, WEIGHT_REVOKED_OUTPUT, weight_offered_htlc, weight_received_htlc}; use crate::chain::Txid; use crate::ln::chan_utils::HTLCOutputInCommitment; - use crate::ln::types::{PaymentPreimage, PaymentHash}; + use crate::types::payment::{PaymentPreimage, PaymentHash}; use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint}; use bitcoin::amount::Amount; diff --git a/lightning/src/events/mod.rs b/lightning/src/events/mod.rs index 56c736209..c450c1d91 100644 --- a/lightning/src/events/mod.rs +++ b/lightning/src/events/mod.rs @@ -25,7 +25,8 @@ use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields}; use crate::ln::channel::FUNDING_CONF_DEADLINE_BLOCKS; use crate::types::features::ChannelTypeFeatures; use crate::ln::msgs; -use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::offers::invoice::Bolt12Invoice; use crate::onion_message::messenger::Responder; use crate::routing::gossip::NetworkUpdate; diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs index fe2e8060f..79b24e06d 100644 --- a/lightning/src/ln/blinded_payment_tests.rs +++ b/lightning/src/ln/blinded_payment_tests.rs @@ -14,7 +14,8 @@ use bitcoin::secp256k1::ecdsa::{RecoverableSignature, Signature}; use crate::blinded_path; use crate::blinded_path::payment::{BlindedPaymentPath, PaymentForwardNode, ForwardTlvs, PaymentConstraints, PaymentContext, PaymentRelay, ReceiveTlvs}; use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PaymentFailureReason}; -use crate::ln::types::{ChannelId, PaymentHash, PaymentSecret}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentHash, PaymentSecret}; use crate::ln::channelmanager; use crate::ln::channelmanager::{HTLCFailureMsg, PaymentId, RecipientOnionFields}; use crate::types::features::{BlindedHopFeatures, ChannelFeatures, NodeFeatures}; diff --git a/lightning/src/ln/bolt11_payment.rs b/lightning/src/ln/bolt11_payment.rs index 13840dc05..2f2e60f12 100644 --- a/lightning/src/ln/bolt11_payment.rs +++ b/lightning/src/ln/bolt11_payment.rs @@ -13,8 +13,8 @@ use bitcoin::hashes::Hash; use lightning_invoice::Bolt11Invoice; use crate::ln::channelmanager::RecipientOnionFields; -use crate::ln::types::PaymentHash; use crate::routing::router::{PaymentParameters, RouteParameters}; +use crate::types::payment::PaymentHash; /// Builds the necessary parameters to pay or pre-flight probe the given zero-amount /// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or @@ -87,8 +87,8 @@ fn params_from_invoice( #[cfg(test)] mod tests { use super::*; - use crate::ln::types::PaymentSecret; use crate::routing::router::Payee; + use crate::types::payment::PaymentSecret; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; use lightning_invoice::{Currency, InvoiceBuilder}; diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 7cd58c087..ae76308f0 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -28,7 +28,7 @@ use bitcoin::hash_types::Txid; use crate::chain::chaininterface::fee_for_weight; use crate::chain::package::WEIGHT_REVOKED_OUTPUT; use crate::sign::EntropySource; -use crate::ln::types::{PaymentHash, PaymentPreimage}; +use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::ln::msgs::DecodeError; use crate::util::ser::{Readable, RequiredWrapper, Writeable, Writer}; use crate::util::transaction_utils; @@ -1901,7 +1901,7 @@ mod tests { use bitcoin::{Network, Txid, ScriptBuf, CompressedPublicKey}; use bitcoin::hashes::Hash; use bitcoin::hex::FromHex; - use crate::ln::types::PaymentHash; + use crate::types::payment::PaymentHash; use bitcoin::PublicKey as BitcoinPublicKey; use crate::types::features::ChannelTypeFeatures; diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 0122106f6..7b7cfb446 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -25,7 +25,8 @@ use bitcoin::secp256k1::{PublicKey,SecretKey}; use bitcoin::secp256k1::{Secp256k1,ecdsa::Signature}; use bitcoin::secp256k1; -use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentPreimage, PaymentHash}; use crate::types::features::{ChannelTypeFeatures, InitFeatures}; use crate::ln::msgs; use crate::ln::msgs::{ClosingSigned, ClosingSignedFeeRange, DecodeError}; @@ -9605,7 +9606,7 @@ mod tests { use bitcoin::opcodes; use bitcoin::network::Network; use crate::ln::onion_utils::INVALID_ONION_BLINDING; - use crate::ln::types::{PaymentHash, PaymentPreimage}; + use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::ln::channel_keys::{RevocationKey, RevocationBasepoint}; use crate::ln::channelmanager::{self, HTLCSource, PaymentId}; use crate::ln::channel::InitFeatures; @@ -10293,7 +10294,7 @@ mod tests { use bitcoin::hex::DisplayHex; use bitcoin::secp256k1::Message; use crate::sign::{ChannelDerivationParameters, HTLCDescriptor, ecdsa::EcdsaChannelSigner}; - use crate::ln::PaymentPreimage; + use crate::types::payment::PaymentPreimage; use crate::ln::channel::{HTLCOutputInCommitment ,TxCreationKeys}; use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint}; use crate::ln::chan_utils::{ChannelPublicKeys, HolderCommitmentTransaction, CounterpartyChannelTransactionParameters}; diff --git a/lightning/src/ln/channel_state.rs b/lightning/src/ln/channel_state.rs index 36e868792..9945bba88 100644 --- a/lightning/src/ln/channel_state.rs +++ b/lightning/src/ln/channel_state.rs @@ -18,9 +18,10 @@ use crate::chain::transaction::OutPoint; use crate::io; use crate::ln::channel::ChannelContext; use crate::ln::msgs::DecodeError; -use crate::ln::types::{ChannelId, PaymentHash}; +use crate::ln::types::ChannelId; use crate::sign::SignerProvider; use crate::types::features::{ChannelTypeFeatures, InitFeatures}; +use crate::types::payment::PaymentHash; use crate::util::config::ChannelConfig; use crate::util::ser::{Readable, Writeable, Writer}; diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 0ffab3bfe..aa903d9b3 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -47,7 +47,8 @@ use crate::events::{Event, EventHandler, EventsProvider, MessageSendEvent, Messa // Since this struct is returned in `list_channels` methods, expose it here in case users want to // construct one themselves. use crate::ln::inbound_payment; -use crate::ln::types::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::ln::channel::{self, Channel, ChannelPhase, ChannelContext, ChannelError, ChannelUpdateStatus, ShutdownResult, UnfundedChannelContext, UpdateFulfillCommitFetch, OutboundV1Channel, InboundV1Channel, WithChannelContext}; use crate::ln::channel_state::ChannelDetails; use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; @@ -1787,7 +1788,7 @@ where /// /// ``` /// # use lightning::events::{Event, EventsProvider}; -/// # use lightning::ln::types::PaymentHash; +/// # use lightning::types::payment::PaymentHash; /// # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, RecipientOnionFields, Retry}; /// # use lightning::routing::router::RouteParameters; /// # @@ -13114,7 +13115,8 @@ mod tests { use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; use core::sync::atomic::Ordering; use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, ClosureReason}; - use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; + use crate::ln::types::ChannelId; + use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::ln::channelmanager::{create_recv_pending_htlc_info, HTLCForwardInfo, inbound_payment, PaymentId, PaymentSendFailure, RecipientOnionFields, InterceptId}; use crate::ln::functional_test_utils::*; use crate::ln::msgs::{self, ErrorAction}; diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index 1643be848..70c64fd21 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -15,7 +15,8 @@ use crate::chain::channelmonitor::ChannelMonitor; use crate::chain::transaction::OutPoint; use crate::events::{ClaimedHTLC, ClosureReason, Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentPurpose, PaymentFailureReason}; use crate::events::bump_transaction::{BumpTransactionEvent, BumpTransactionEventHandler, Wallet, WalletSource}; -use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::ln::channelmanager::{AChannelManager, ChainParameters, ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, PaymentSendFailure, RecipientOnionFields, PaymentId, MIN_CLTV_EXPIRY_DELTA}; use crate::types::features::InitFeatures; use crate::ln::msgs; diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index 62885409d..d917ff29a 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -19,7 +19,8 @@ use crate::chain::channelmonitor::{CLOSED_CHANNEL_UPDATE_ID, CLTV_CLAIM_BUFFER, use crate::chain::transaction::OutPoint; use crate::sign::{ecdsa::EcdsaChannelSigner, EntropySource, OutputSpender, SignerProvider}; use crate::events::{Event, FundingInfo, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentPurpose, ClosureReason, HTLCDestination, PaymentFailureReason}; -use crate::ln::types::{ChannelId, PaymentPreimage, PaymentSecret, PaymentHash}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentPreimage, PaymentSecret, PaymentHash}; use crate::ln::channel::{CONCURRENT_INBOUND_HTLC_FEE_BUFFER, FEE_SPIKE_BUFFER_FEE_INCREASE_MULTIPLE, MIN_AFFORDABLE_HTLC_COUNT, get_holder_selected_channel_reserve_satoshis, OutboundV1Channel, InboundV1Channel, COINBASE_MATURITY, ChannelPhase}; use crate::ln::channelmanager::{self, PaymentId, RAACommitmentOrder, PaymentSendFailure, RecipientOnionFields, BREAKDOWN_TIMEOUT, ENABLE_GOSSIP_TICKS, DISABLE_GOSSIP_TICKS, MIN_CLTV_EXPIRY_DELTA}; use crate::ln::channel::{DISCONNECT_PEER_AWAITING_RESPONSE_TICKS, ChannelError}; diff --git a/lightning/src/ln/inbound_payment.rs b/lightning/src/ln/inbound_payment.rs index 0ae260a50..e294dcbcf 100644 --- a/lightning/src/ln/inbound_payment.rs +++ b/lightning/src/ln/inbound_payment.rs @@ -18,7 +18,7 @@ use crate::crypto::chacha20::ChaCha20; use crate::crypto::utils::hkdf_extract_expand_5x; use crate::ln::msgs; use crate::ln::msgs::MAX_VALUE_MSAT; -use crate::ln::types::{PaymentHash, PaymentPreimage, PaymentSecret}; +use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::offers::nonce::Nonce; use crate::sign::{KeyMaterial, EntropySource}; use crate::util::errors::APIError; diff --git a/lightning/src/ln/invoice_utils.rs b/lightning/src/ln/invoice_utils.rs index 4c7e347da..b9d1c45bc 100644 --- a/lightning/src/ln/invoice_utils.rs +++ b/lightning/src/ln/invoice_utils.rs @@ -9,7 +9,7 @@ use bitcoin::hashes::Hash; use crate::chain; use crate::chain::chaininterface::{BroadcasterInterface, FeeEstimator}; use crate::sign::{Recipient, NodeSigner, SignerProvider, EntropySource}; -use crate::ln::types::{PaymentHash, PaymentSecret}; +use crate::types::payment::{PaymentHash, PaymentSecret}; use crate::ln::channel_state::ChannelDetails; use crate::ln::channelmanager::{ChannelManager, MIN_FINAL_CLTV_EXPIRY_DELTA}; use crate::ln::channelmanager::{PhantomRouteHints, MIN_CLTV_EXPIRY_DELTA}; @@ -835,8 +835,7 @@ mod test { use bitcoin::hashes::sha256::Hash as Sha256; use crate::sign::PhantomKeysManager; use crate::events::{MessageSendEvent, MessageSendEventsProvider}; - use crate::ln::types::PaymentHash; - use crate::ln::types::PaymentPreimage; + use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::ln::channelmanager::{PhantomRouteHints, MIN_FINAL_CLTV_EXPIRY_DELTA, PaymentId, RecipientOnionFields, Retry}; use crate::ln::functional_test_utils::*; use crate::ln::msgs::ChannelMessageHandler; diff --git a/lightning/src/ln/max_payment_path_len_tests.rs b/lightning/src/ln/max_payment_path_len_tests.rs index a6252fd2b..8c24ef363 100644 --- a/lightning/src/ln/max_payment_path_len_tests.rs +++ b/lightning/src/ln/max_payment_path_len_tests.rs @@ -14,7 +14,7 @@ use bitcoin::secp256k1::{Secp256k1, PublicKey}; use crate::blinded_path::BlindedHop; use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath, PaymentConstraints, PaymentContext, ReceiveTlvs}; use crate::events::{Event, MessageSendEventsProvider}; -use crate::ln::PaymentSecret; +use crate::types::payment::PaymentSecret; use crate::ln::blinded_payment_tests::get_blinded_route_parameters; use crate::ln::channelmanager::PaymentId; use crate::types::features::BlindedHopFeatures; diff --git a/lightning/src/ln/mod.rs b/lightning/src/ln/mod.rs index dceb52ab4..90571b0d8 100644 --- a/lightning/src/ln/mod.rs +++ b/lightning/src/ln/mod.rs @@ -8,12 +8,6 @@ // licenses. //! Implementations of various parts of the Lightning protocol are in this module. -//! -//! Note that the re-exports of [`PaymentHash`], [`PaymentPreimage`], and [`PaymentSecret`] here -//! are deprecated and will be removed in a future version. Instead, use them via -//! [`lightning::types::payment`]. -//! -//! [`lightning::types::payment`]: crate::types::payment #[cfg(any(test, feature = "_test_utils"))] #[macro_use] @@ -36,8 +30,6 @@ pub mod types; pub mod invoice_utils; pub mod bolt11_payment; -pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; - #[cfg(fuzzing)] pub mod peer_channel_encryptor; #[cfg(not(fuzzing))] diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 39c998092..9d1269c56 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -32,7 +32,8 @@ use bitcoin::script::ScriptBuf; use bitcoin::hash_types::Txid; use crate::blinded_path::payment::{BlindedPaymentTlvs, ForwardTlvs, ReceiveTlvs}; -use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; use crate::ln::onion_utils; use crate::onion_message; @@ -1746,7 +1747,7 @@ pub struct FinalOnionHopData { mod fuzzy_internal_msgs { use bitcoin::secp256k1::PublicKey; use crate::blinded_path::payment::{PaymentConstraints, PaymentContext, PaymentRelay}; - use crate::ln::types::{PaymentPreimage, PaymentSecret}; + use crate::types::payment::{PaymentPreimage, PaymentSecret}; use crate::types::features::BlindedHopFeatures; use super::{FinalOnionHopData, TrampolineOnionPacket}; @@ -3298,7 +3299,8 @@ impl_writeable_msg!(GossipTimestampFilter, { mod tests { use bitcoin::{Amount, Transaction, TxIn, ScriptBuf, Sequence, Witness, TxOut}; use bitcoin::hex::DisplayHex; - use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; + use crate::ln::types::ChannelId; + use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; use crate::ln::msgs::{self, FinalOnionHopData, OnionErrorPacket, CommonOpenChannelFields, CommonAcceptChannelFields, TrampolineOnionPacket}; use crate::ln::msgs::SocketAddress; diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index 457834662..528b5e7d8 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -11,7 +11,7 @@ use bitcoin::secp256k1::{self, PublicKey, Scalar, Secp256k1}; use crate::blinded_path; use crate::blinded_path::payment::{PaymentConstraints, PaymentRelay}; use crate::chain::channelmonitor::{HTLC_FAIL_BACK_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS}; -use crate::ln::types::PaymentHash; +use crate::types::payment::PaymentHash; use crate::ln::channelmanager::{BlindedFailure, BlindedForward, CLTV_FAR_FAR_AWAY, HTLCFailureMsg, MIN_CLTV_EXPIRY_DELTA, PendingHTLCInfo, PendingHTLCRouting}; use crate::types::features::BlindedHopFeatures; use crate::ln::msgs; @@ -508,7 +508,8 @@ mod tests { use bitcoin::hashes::Hash; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; - use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; + use crate::ln::types::ChannelId; + use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::ln::channelmanager::RecipientOnionFields; use crate::types::features::{ChannelFeatures, NodeFeatures}; use crate::ln::msgs; diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index cad012626..c0253166d 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -14,7 +14,7 @@ use crate::chain::channelmonitor::{CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS}; use crate::sign::{EntropySource, NodeSigner, Recipient}; use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentFailureReason}; -use crate::ln::types::{PaymentHash, PaymentSecret}; +use crate::types::payment::{PaymentHash, PaymentSecret}; use crate::ln::channel::EXPIRE_PREV_CONFIG_TICKS; use crate::ln::channelmanager::{HTLCForwardInfo, FailureCode, CLTV_FAR_FAR_AWAY, DISABLE_GOSSIP_TICKS, MIN_CLTV_EXPIRY_DELTA, PendingAddHTLCInfo, PendingHTLCInfo, PendingHTLCRouting, PaymentId, RecipientOnionFields}; use crate::ln::onion_utils; diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index 33eec9dff..208096c12 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -13,11 +13,11 @@ use crate::crypto::streams::ChaChaReader; use crate::ln::channel::TOTAL_BITCOIN_SUPPLY_SATOSHIS; use crate::ln::channelmanager::{HTLCSource, RecipientOnionFields}; use crate::ln::msgs; -use crate::ln::types::{PaymentHash, PaymentPreimage}; use crate::routing::gossip::NetworkUpdate; use crate::routing::router::{Path, RouteHop, RouteParameters}; use crate::sign::NodeSigner; use crate::types::features::{ChannelFeatures, NodeFeatures}; +use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::util::errors::{self, APIError}; use crate::util::logger::Logger; use crate::util::ser::{LengthCalculatingWriter, Readable, ReadableArgs, Writeable, Writer}; @@ -1271,9 +1271,9 @@ fn decode_next_hop, N: NextPacketBytes>( mod tests { use crate::io; use crate::ln::msgs; - use crate::ln::types::PaymentHash; use crate::routing::router::{Path, Route, RouteHop}; use crate::types::features::{ChannelFeatures, NodeFeatures}; + use crate::types::payment::PaymentHash; use crate::util::ser::{VecWriter, Writeable, Writer}; #[allow(unused_imports)] diff --git a/lightning/src/ln/outbound_payment.rs b/lightning/src/ln/outbound_payment.rs index b592ae0c4..9c8998b89 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -15,7 +15,7 @@ use bitcoin::secp256k1::{self, Secp256k1, SecretKey}; use crate::blinded_path::{IntroductionNode, NodeIdLookUp}; use crate::events::{self, PaymentFailureReason}; -use crate::ln::types::{PaymentHash, PaymentPreimage, PaymentSecret}; +use crate::types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::ln::channel_state::ChannelDetails; use crate::ln::channelmanager::{EventCompletionAction, HTLCSource, PaymentId}; use crate::types::features::Bolt12InvoiceFeatures; @@ -2265,7 +2265,7 @@ mod tests { use crate::blinded_path::EmptyNodeIdLookUp; use crate::events::{Event, PathFailure, PaymentFailureReason}; - use crate::ln::types::{PaymentHash, PaymentPreimage}; + use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::ln::channelmanager::{PaymentId, RecipientOnionFields}; use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, NodeFeatures}; use crate::ln::msgs::{ErrorAction, LightningError}; diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index 2f6a14e8c..7839b49be 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -19,7 +19,8 @@ use crate::ln::channel::{EXPIRE_PREV_CONFIG_TICKS, get_holder_selected_channel_r use crate::ln::channelmanager::{BREAKDOWN_TIMEOUT, MPP_TIMEOUT_TICKS, MIN_CLTV_EXPIRY_DELTA, PaymentId, PaymentSendFailure, RecentPaymentDetails, RecipientOnionFields, HTLCForwardInfo, PendingHTLCRouting, PendingAddHTLCInfo}; use crate::types::features::{Bolt11InvoiceFeatures, ChannelTypeFeatures}; use crate::ln::msgs; -use crate::ln::types::{ChannelId, PaymentHash, PaymentSecret, PaymentPreimage}; +use crate::ln::types::ChannelId; +use crate::types::payment::{PaymentHash, PaymentSecret, PaymentPreimage}; use crate::ln::chan_utils; use crate::ln::msgs::ChannelMessageHandler; use crate::ln::onion_utils; diff --git a/lightning/src/ln/types.rs b/lightning/src/ln/types.rs index dbe1e216b..48b663afe 100644 --- a/lightning/src/ln/types.rs +++ b/lightning/src/ln/types.rs @@ -8,12 +8,6 @@ // licenses. //! Various wrapper types (most around 32-byte arrays) for use in lightning. -//! -//! Note that the re-exports of [`PaymentHash`], [`PaymentPreimage`], and [`PaymentSecret`] here -//! are deprecated and will be removed in a future version. Instead, use them via -//! [`lightning::types::payment`]. -//! -//! [`lightning::types::payment`]: crate::types::payment use crate::chain::transaction::OutPoint; use crate::io; @@ -134,8 +128,6 @@ impl_fmt_traits! { } } -pub use lightning_types::payment::{PaymentHash, PaymentPreimage, PaymentSecret}; - #[cfg(test)] mod tests { use bitcoin::hashes::{ diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index d1fa54b8f..844018012 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -28,7 +28,7 @@ //! use lightning::offers::refund::Refund; //! use lightning::util::ser::Writeable; //! -//! # use lightning::ln::types::PaymentHash; +//! # use lightning::types::payment::PaymentHash; //! # use lightning::offers::invoice::{ExplicitSigningPubkey, InvoiceBuilder}; //! # use lightning::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath}; //! # @@ -113,7 +113,7 @@ use crate::io; use crate::blinded_path::BlindedPath; use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath}; -use crate::ln::types::PaymentHash; +use crate::types::payment::PaymentHash; use crate::ln::channelmanager::PaymentId; use crate::types::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures}; use crate::ln::inbound_payment::{ExpandedKey, IV_LEN}; diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index 3fcc50b5e..fed8bfee2 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -64,7 +64,7 @@ use bitcoin::secp256k1::schnorr::Signature; use crate::io; use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::BlindedPaymentPath; -use crate::ln::types::PaymentHash; +use crate::types::payment::PaymentHash; use crate::ln::channelmanager::PaymentId; use crate::types::features::InvoiceRequestFeatures; use crate::ln::inbound_payment::{ExpandedKey, IV_LEN}; diff --git a/lightning/src/offers/refund.rs b/lightning/src/offers/refund.rs index 8c580bdcc..8d76534ff 100644 --- a/lightning/src/offers/refund.rs +++ b/lightning/src/offers/refund.rs @@ -93,7 +93,7 @@ use crate::sign::EntropySource; use crate::io; use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::BlindedPaymentPath; -use crate::ln::types::PaymentHash; +use crate::types::payment::PaymentHash; use crate::ln::channelmanager::PaymentId; use crate::types::features::InvoiceRequestFeatures; use crate::ln::inbound_payment::{ExpandedKey, IV_LEN}; diff --git a/lightning/src/offers/test_utils.rs b/lightning/src/offers/test_utils.rs index fc6d9f755..3c6016e20 100644 --- a/lightning/src/offers/test_utils.rs +++ b/lightning/src/offers/test_utils.rs @@ -16,7 +16,7 @@ use core::time::Duration; use crate::blinded_path::BlindedHop; use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath}; use crate::sign::EntropySource; -use crate::ln::types::PaymentHash; +use crate::types::payment::PaymentHash; use crate::types::features::BlindedHopFeatures; use crate::offers::merkle::TaggedHash; diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 9bdacab4b..513ccd6ad 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -13,7 +13,7 @@ use bitcoin::secp256k1::{PublicKey, Secp256k1, self}; use crate::blinded_path::{BlindedHop, Direction, IntroductionNode}; use crate::blinded_path::payment::{BlindedPaymentPath, ForwardTlvs, PaymentConstraints, PaymentForwardNode, PaymentRelay, ReceiveTlvs}; -use crate::ln::{PaymentHash, PaymentPreimage}; +use crate::types::payment::{PaymentHash, PaymentPreimage}; use crate::ln::channel_state::ChannelDetails; use crate::ln::channelmanager::{PaymentId, MIN_FINAL_CLTV_EXPIRY_DELTA, RecipientOnionFields}; use crate::types::features::{BlindedHopFeatures, Bolt11InvoiceFeatures, Bolt12InvoiceFeatures, ChannelFeatures, NodeFeatures}; diff --git a/lightning/src/sign/ecdsa.rs b/lightning/src/sign/ecdsa.rs index ecdd45aa3..afaa2c35a 100644 --- a/lightning/src/sign/ecdsa.rs +++ b/lightning/src/sign/ecdsa.rs @@ -10,7 +10,7 @@ use crate::ln::chan_utils::{ ClosingTransaction, CommitmentTransaction, HTLCOutputInCommitment, HolderCommitmentTransaction, }; use crate::ln::msgs::UnsignedChannelAnnouncement; -use crate::ln::types::PaymentPreimage; +use crate::types::payment::PaymentPreimage; #[allow(unused_imports)] use crate::prelude::*; diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index c1a70e5e8..70c5039b8 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -55,9 +55,9 @@ use crate::ln::channel_keys::{ use crate::ln::msgs::PartialSignatureWithNonce; use crate::ln::msgs::{UnsignedChannelAnnouncement, UnsignedGossipMessage}; use crate::ln::script::ShutdownScript; -use crate::ln::types::PaymentPreimage; use crate::offers::invoice::UnsignedBolt12Invoice; use crate::offers::invoice_request::UnsignedInvoiceRequest; +use crate::types::payment::PaymentPreimage; use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer}; use crate::util::transaction_utils; diff --git a/lightning/src/sign/taproot.rs b/lightning/src/sign/taproot.rs index 740942bc0..ebfaad26c 100644 --- a/lightning/src/sign/taproot.rs +++ b/lightning/src/sign/taproot.rs @@ -11,8 +11,8 @@ use crate::ln::chan_utils::{ ClosingTransaction, CommitmentTransaction, HTLCOutputInCommitment, HolderCommitmentTransaction, }; use crate::ln::msgs::PartialSignatureWithNonce; -use crate::ln::PaymentPreimage; use crate::sign::{ChannelSigner, HTLCDescriptor}; +use crate::types::payment::PaymentPreimage; /// A Taproot-specific signer type that defines signing-related methods that are either unique to /// Taproot or have argument or return types that differ from the ones an ECDSA signer would be diff --git a/lightning/src/util/logger.rs b/lightning/src/util/logger.rs index 0b29ea1a9..86c9ea4a8 100644 --- a/lightning/src/util/logger.rs +++ b/lightning/src/util/logger.rs @@ -21,9 +21,9 @@ use core::fmt; use core::ops::Deref; use crate::ln::types::ChannelId; -use crate::ln::PaymentHash; #[cfg(c_bindings)] use crate::prelude::*; // Needed for String +use crate::types::payment::PaymentHash; static LOG_LEVEL_NAMES: [&'static str; 6] = ["GOSSIP", "TRACE", "DEBUG", "INFO", "WARN", "ERROR"]; @@ -265,8 +265,8 @@ impl + Clone> fmt::Display fo #[cfg(test)] mod tests { use crate::ln::types::ChannelId; - use crate::ln::PaymentHash; use crate::sync::Arc; + use crate::types::payment::PaymentHash; use crate::util::logger::{Level, Logger, WithContext}; use crate::util::test_utils::TestLogger; use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; diff --git a/lightning/src/util/ser.rs b/lightning/src/util/ser.rs index e27d49293..5c1a82d4b 100644 --- a/lightning/src/util/ser.rs +++ b/lightning/src/util/ser.rs @@ -45,7 +45,7 @@ use crate::chain::ClaimId; use crate::ln::msgs::DecodeError; #[cfg(taproot)] use crate::ln::msgs::PartialSignatureWithNonce; -use crate::ln::types::{PaymentPreimage, PaymentHash, PaymentSecret}; +use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret}; use crate::util::byte_utils::{be48_to_array, slice_to_be48}; use crate::util::string::UntrustedString; diff --git a/lightning/src/util/test_channel_signer.rs b/lightning/src/util/test_channel_signer.rs index 9a1a75e92..9cfeb9c18 100644 --- a/lightning/src/util/test_channel_signer.rs +++ b/lightning/src/util/test_channel_signer.rs @@ -11,7 +11,7 @@ use crate::ln::channel::{ANCHOR_OUTPUT_VALUE_SATOSHI, MIN_CHAN_DUST_LIMIT_SATOSH use crate::ln::chan_utils::{HTLCOutputInCommitment, ChannelPublicKeys, HolderCommitmentTransaction, CommitmentTransaction, ChannelTransactionParameters, TrustedCommitmentTransaction, ClosingTransaction}; use crate::ln::channel_keys::{HtlcKey}; use crate::ln::msgs; -use crate::ln::types::PaymentPreimage; +use crate::types::payment::PaymentPreimage; use crate::sign::{InMemorySigner, ChannelSigner}; use crate::sign::ecdsa::EcdsaChannelSigner;