From 64c12431b7645718099c3dad95a620e5c7ba23a9 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 12 Oct 2024 21:34:36 +0000 Subject: [PATCH] Drop `lightning::ln::features::*` type aliases These were deprecated in 0.0.124, and we drop them here in favor of `lightning::types::features::*`. --- fuzz/src/invoice_request_deser.rs | 2 +- fuzz/src/onion_message.rs | 2 +- fuzz/src/refund_deser.rs | 2 +- fuzz/src/router.rs | 2 +- lightning-background-processor/src/lib.rs | 2 +- lightning-custom-message/src/lib.rs | 10 ++++----- lightning-net-tokio/src/lib.rs | 2 +- lightning-rapid-gossip-sync/src/processing.rs | 2 +- lightning/src/blinded_path/payment.rs | 4 ++-- lightning/src/chain/channelmonitor.rs | 2 +- lightning/src/chain/onchaintx.rs | 2 +- lightning/src/chain/package.rs | 4 ++-- lightning/src/events/mod.rs | 2 +- lightning/src/ln/blinded_payment_tests.rs | 2 +- lightning/src/ln/chan_utils.rs | 4 ++-- lightning/src/ln/channel.rs | 4 ++-- lightning/src/ln/channel_state.rs | 2 +- lightning/src/ln/channelmanager.rs | 4 ++-- lightning/src/ln/features.rs | 21 ++++++------------- lightning/src/ln/functional_test_utils.rs | 2 +- lightning/src/ln/functional_tests.rs | 2 +- .../src/ln/max_payment_path_len_tests.rs | 2 +- lightning/src/ln/msgs.rs | 6 +++--- lightning/src/ln/offers_tests.rs | 2 +- lightning/src/ln/onion_payment.rs | 4 ++-- lightning/src/ln/onion_route_tests.rs | 2 +- lightning/src/ln/onion_utils.rs | 4 ++-- lightning/src/ln/outbound_payment.rs | 4 ++-- lightning/src/ln/payment_tests.rs | 2 +- lightning/src/ln/peer_handler.rs | 4 ++-- lightning/src/ln/priv_short_conf_tests.rs | 2 +- lightning/src/ln/script.rs | 4 ++-- lightning/src/offers/invoice.rs | 4 ++-- lightning/src/offers/invoice_request.rs | 6 +++--- lightning/src/offers/offer.rs | 6 +++--- lightning/src/offers/refund.rs | 4 ++-- lightning/src/offers/static_invoice.rs | 4 ++-- lightning/src/offers/test_utils.rs | 2 +- .../src/onion_message/functional_tests.rs | 2 +- lightning/src/onion_message/messenger.rs | 2 +- lightning/src/routing/gossip.rs | 6 +++--- lightning/src/routing/router.rs | 6 +++--- lightning/src/routing/scoring.rs | 2 +- lightning/src/routing/test_utils.rs | 2 +- lightning/src/sign/mod.rs | 2 +- lightning/src/util/errors.rs | 2 +- lightning/src/util/test_channel_signer.rs | 2 +- lightning/src/util/test_utils.rs | 2 +- 48 files changed, 80 insertions(+), 89 deletions(-) diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs index fb5122ec2..2bebb0233 100644 --- a/fuzz/src/invoice_request_deser.rs +++ b/fuzz/src/invoice_request_deser.rs @@ -15,7 +15,6 @@ use lightning::blinded_path::payment::{ PaymentForwardNode, PaymentRelay, ReceiveTlvs, }; use lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA; -use lightning::ln::features::BlindedHopFeatures; use lightning::ln::types::PaymentSecret; use lightning::ln::PaymentHash; use lightning::offers::invoice::UnsignedBolt12Invoice; @@ -23,6 +22,7 @@ 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::util::ser::Writeable; use lightning::util::string::UntrustedString; diff --git a/fuzz/src/onion_message.rs b/fuzz/src/onion_message.rs index cf87467a5..09d1d9b6b 100644 --- a/fuzz/src/onion_message.rs +++ b/fuzz/src/onion_message.rs @@ -9,7 +9,6 @@ use lightning::blinded_path::message::{ AsyncPaymentsContext, BlindedMessagePath, MessageContext, OffersContext, }; use lightning::blinded_path::EmptyNodeIdLookUp; -use lightning::ln::features::InitFeatures; use lightning::ln::msgs::{self, DecodeError, OnionMessageHandler}; use lightning::ln::peer_handler::IgnoringMessageHandler; use lightning::ln::script::ShutdownScript; @@ -25,6 +24,7 @@ use lightning::onion_message::messenger::{ use lightning::onion_message::offers::{OffersMessage, OffersMessageHandler}; use lightning::onion_message::packet::OnionMessageContents; use lightning::sign::{EntropySource, KeyMaterial, NodeSigner, Recipient, SignerProvider}; +use lightning::types::features::InitFeatures; use lightning::util::logger::Logger; use lightning::util::ser::{Readable, Writeable, Writer}; use lightning::util::test_channel_signer::TestChannelSigner; diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs index b60b4f844..148a59fdd 100644 --- a/fuzz/src/refund_deser.rs +++ b/fuzz/src/refund_deser.rs @@ -15,13 +15,13 @@ use lightning::blinded_path::payment::{ PaymentForwardNode, PaymentRelay, ReceiveTlvs, }; use lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA; -use lightning::ln::features::BlindedHopFeatures; 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::util::ser::Writeable; #[inline] diff --git a/fuzz/src/router.rs b/fuzz/src/router.rs index df97cbb97..6bf9e300f 100644 --- a/fuzz/src/router.rs +++ b/fuzz/src/router.rs @@ -17,7 +17,6 @@ use lightning::blinded_path::BlindedHop; use lightning::chain::transaction::OutPoint; use lightning::ln::channel_state::{ChannelCounterparty, ChannelDetails, ChannelShutdownState}; use lightning::ln::channelmanager; -use lightning::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures}; use lightning::ln::msgs; use lightning::ln::types::ChannelId; use lightning::routing::gossip::{NetworkGraph, RoutingFees}; @@ -28,6 +27,7 @@ use lightning::routing::scoring::{ ProbabilisticScorer, ProbabilisticScoringDecayParameters, ProbabilisticScoringFeeParameters, }; use lightning::routing::utxo::{UtxoFuture, UtxoLookup, UtxoLookupError, UtxoResult}; +use lightning::types::features::{BlindedHopFeatures, Bolt12InvoiceFeatures}; use lightning::util::config::UserConfig; use lightning::util::hash_tables::*; use lightning::util::ser::Readable; diff --git a/lightning-background-processor/src/lib.rs b/lightning-background-processor/src/lib.rs index 318dfcbbd..cea975fb0 100644 --- a/lightning-background-processor/src/lib.rs +++ b/lightning-background-processor/src/lib.rs @@ -1087,7 +1087,6 @@ mod tests { use lightning::ln::channelmanager::{ ChainParameters, PaymentId, BREAKDOWN_TIMEOUT, MIN_CLTV_EXPIRY_DELTA, }; - use lightning::ln::features::{ChannelFeatures, NodeFeatures}; use lightning::ln::functional_test_utils::*; use lightning::ln::msgs::{ChannelMessageHandler, Init}; use lightning::ln::peer_handler::{ @@ -1099,6 +1098,7 @@ mod tests { 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::util::config::UserConfig; use lightning::util::persist::{ KVStore, CHANNEL_MANAGER_PERSISTENCE_KEY, CHANNEL_MANAGER_PERSISTENCE_PRIMARY_NAMESPACE, diff --git a/lightning-custom-message/src/lib.rs b/lightning-custom-message/src/lib.rs index c9758986d..fb0ba191c 100644 --- a/lightning-custom-message/src/lib.rs +++ b/lightning-custom-message/src/lib.rs @@ -21,9 +21,9 @@ //! # use bitcoin::secp256k1::PublicKey; //! # use lightning::io; //! # use lightning::ln::msgs::{DecodeError, Init, LightningError}; -//! # use lightning::ln::features::{InitFeatures, NodeFeatures}; //! use lightning::ln::peer_handler::CustomMessageHandler; //! use lightning::ln::wire::{CustomMessageReader, self}; +//! # use lightning::types::features::{InitFeatures, NodeFeatures}; //! use lightning::util::ser::Writeable; //! # use lightning::util::ser::Writer; //! @@ -321,8 +321,8 @@ macro_rules! composite_custom_message_handler { result } - fn provided_node_features(&self) -> $crate::lightning::ln::features::NodeFeatures { - $crate::lightning::ln::features::NodeFeatures::empty() + fn provided_node_features(&self) -> $crate::lightning::types::features::NodeFeatures { + $crate::lightning::types::features::NodeFeatures::empty() $( | self.$field.provided_node_features() )* @@ -330,8 +330,8 @@ macro_rules! composite_custom_message_handler { fn provided_init_features( &self, their_node_id: $crate::bitcoin::secp256k1::PublicKey - ) -> $crate::lightning::ln::features::InitFeatures { - $crate::lightning::ln::features::InitFeatures::empty() + ) -> $crate::lightning::types::features::InitFeatures { + $crate::lightning::types::features::InitFeatures::empty() $( | self.$field.provided_init_features(their_node_id) )* diff --git a/lightning-net-tokio/src/lib.rs b/lightning-net-tokio/src/lib.rs index 89ac7a52e..944033102 100644 --- a/lightning-net-tokio/src/lib.rs +++ b/lightning-net-tokio/src/lib.rs @@ -624,10 +624,10 @@ mod tests { use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; use bitcoin::Network; use lightning::events::*; - use lightning::ln::features::*; use lightning::ln::msgs::*; use lightning::ln::peer_handler::{IgnoringMessageHandler, MessageHandler, PeerManager}; use lightning::routing::gossip::NodeId; + use lightning::types::features::*; use lightning::util::test_utils::TestNodeSigner; use tokio::sync::mpsc; diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs index b87c1be39..c61187fcf 100644 --- a/lightning-rapid-gossip-sync/src/processing.rs +++ b/lightning-rapid-gossip-sync/src/processing.rs @@ -22,7 +22,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; #[cfg(all(not(feature = "std"), not(test)))] use alloc::{borrow::ToOwned, vec::Vec}; -use lightning::ln::features::NodeFeatures; +use lightning::types::features::NodeFeatures; /// The purpose of this prefix is to identify the serialization format, should other rapid gossip /// sync formats arise in the future. diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs index f741cead2..69ee5ce4b 100644 --- a/lightning/src/blinded_path/payment.rs +++ b/lightning/src/blinded_path/payment.rs @@ -18,7 +18,7 @@ use crate::io; use crate::io::Cursor; use crate::ln::types::PaymentSecret; use crate::ln::channel_state::CounterpartyForwardingInfo; -use crate::ln::features::BlindedHopFeatures; +use crate::types::features::BlindedHopFeatures; use crate::ln::msgs::DecodeError; use crate::ln::onion_utils; use crate::offers::invoice_request::InvoiceRequestFields; @@ -633,7 +633,7 @@ mod tests { use bitcoin::secp256k1::PublicKey; use crate::blinded_path::payment::{PaymentForwardNode, ForwardTlvs, ReceiveTlvs, PaymentConstraints, PaymentContext, PaymentRelay}; use crate::ln::types::PaymentSecret; - use crate::ln::features::BlindedHopFeatures; + use crate::types::features::BlindedHopFeatures; use crate::ln::functional_test_utils::TEST_FINAL_CLTV; #[test] diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index 86f0d3de5..b0ac1a34c 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -5018,7 +5018,7 @@ mod tests { use crate::util::logger::Logger; use crate::sync::Arc; use crate::io; - use crate::ln::features::ChannelTypeFeatures; + use crate::types::features::ChannelTypeFeatures; #[allow(unused_imports)] use crate::prelude::*; diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index 7ac8f9a63..56b34818a 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -44,7 +44,7 @@ use core::cmp; use core::ops::Deref; use core::mem::replace; use core::mem::swap; -use crate::ln::features::ChannelTypeFeatures; +use crate::types::features::ChannelTypeFeatures; const MAX_ALLOC_SIZE: usize = 64*1024; diff --git a/lightning/src/chain/package.rs b/lightning/src/chain/package.rs index 0ff7fd186..1ab124b8c 100644 --- a/lightning/src/chain/package.rs +++ b/lightning/src/chain/package.rs @@ -26,7 +26,7 @@ use bitcoin::transaction::Version; use crate::ln::types::PaymentPreimage; use crate::ln::chan_utils::{self, TxCreationKeys, HTLCOutputInCommitment}; -use crate::ln::features::ChannelTypeFeatures; +use crate::types::features::ChannelTypeFeatures; use crate::ln::channel_keys::{DelayedPaymentBasepoint, HtlcBasepoint}; use crate::ln::msgs::DecodeError; use crate::chain::chaininterface::{FeeEstimator, ConfirmationTarget, MIN_RELAY_FEE_SAT_PER_1000_WEIGHT, compute_feerate_sat_per_1000_weight, FEERATE_FLOOR_SATS_PER_KW}; @@ -1211,7 +1211,7 @@ mod tests { use bitcoin::secp256k1::{PublicKey,SecretKey}; use bitcoin::secp256k1::Secp256k1; - use crate::ln::features::ChannelTypeFeatures; + use crate::types::features::ChannelTypeFeatures; use std::str::FromStr; diff --git a/lightning/src/events/mod.rs b/lightning/src/events/mod.rs index 4a179f439..56c736209 100644 --- a/lightning/src/events/mod.rs +++ b/lightning/src/events/mod.rs @@ -23,7 +23,7 @@ use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, Paym use crate::chain::transaction; use crate::ln::channelmanager::{InterceptId, PaymentId, RecipientOnionFields}; use crate::ln::channel::FUNDING_CONF_DEADLINE_BLOCKS; -use crate::ln::features::ChannelTypeFeatures; +use crate::types::features::ChannelTypeFeatures; use crate::ln::msgs; use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; use crate::offers::invoice::Bolt12Invoice; diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs index d099e439a..fe2e8060f 100644 --- a/lightning/src/ln/blinded_payment_tests.rs +++ b/lightning/src/ln/blinded_payment_tests.rs @@ -17,7 +17,7 @@ use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsP use crate::ln::types::{ChannelId, PaymentHash, PaymentSecret}; use crate::ln::channelmanager; use crate::ln::channelmanager::{HTLCFailureMsg, PaymentId, RecipientOnionFields}; -use crate::ln::features::{BlindedHopFeatures, ChannelFeatures, NodeFeatures}; +use crate::types::features::{BlindedHopFeatures, ChannelFeatures, NodeFeatures}; use crate::ln::functional_test_utils::*; use crate::ln::msgs; use crate::ln::msgs::{ChannelMessageHandler, UnsignedGossipMessage}; diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 0a18b5aac..7cd58c087 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -45,7 +45,7 @@ use crate::util::transaction_utils::sort_outputs; use crate::ln::channel::{INITIAL_COMMITMENT_NUMBER, ANCHOR_OUTPUT_VALUE_SATOSHI}; use core::ops::Deref; use crate::chain; -use crate::ln::features::ChannelTypeFeatures; +use crate::types::features::ChannelTypeFeatures; use crate::crypto::utils::{sign, sign_with_aux_rand}; use super::channel_keys::{DelayedPaymentBasepoint, DelayedPaymentKey, HtlcKey, HtlcBasepoint, RevocationKey, RevocationBasepoint}; @@ -1903,7 +1903,7 @@ mod tests { use bitcoin::hex::FromHex; use crate::ln::types::PaymentHash; use bitcoin::PublicKey as BitcoinPublicKey; - use crate::ln::features::ChannelTypeFeatures; + use crate::types::features::ChannelTypeFeatures; #[allow(unused_imports)] use crate::prelude::*; diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 250704ea2..0122106f6 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -26,7 +26,7 @@ use bitcoin::secp256k1::{Secp256k1,ecdsa::Signature}; use bitcoin::secp256k1; use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash}; -use crate::ln::features::{ChannelTypeFeatures, InitFeatures}; +use crate::types::features::{ChannelTypeFeatures, InitFeatures}; use crate::ln::msgs; use crate::ln::msgs::{ClosingSigned, ClosingSignedFeeRange, DecodeError}; use crate::ln::script::{self, ShutdownScript}; @@ -9611,7 +9611,7 @@ mod tests { use crate::ln::channel::InitFeatures; use crate::ln::channel::{AwaitingChannelReadyFlags, Channel, ChannelState, InboundHTLCOutput, OutboundV1Channel, InboundV1Channel, OutboundHTLCOutput, InboundHTLCState, OutboundHTLCState, HTLCCandidate, HTLCInitiator, HTLCUpdateAwaitingACK, commit_tx_fee_sat}; use crate::ln::channel::{MAX_FUNDING_SATOSHIS_NO_WUMBO, TOTAL_BITCOIN_SUPPLY_SATOSHIS, MIN_THEIR_CHAN_RESERVE_SATOSHIS}; - use crate::ln::features::{ChannelFeatures, ChannelTypeFeatures, NodeFeatures}; + use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, NodeFeatures}; use crate::ln::msgs; use crate::ln::msgs::{ChannelUpdate, DecodeError, UnsignedChannelUpdate, MAX_VALUE_MSAT}; use crate::ln::script::ShutdownScript; diff --git a/lightning/src/ln/channel_state.rs b/lightning/src/ln/channel_state.rs index 6f5ed5afe..36e868792 100644 --- a/lightning/src/ln/channel_state.rs +++ b/lightning/src/ln/channel_state.rs @@ -17,10 +17,10 @@ use crate::chain::chaininterface::{FeeEstimator, LowerBoundedFeeEstimator}; use crate::chain::transaction::OutPoint; use crate::io; use crate::ln::channel::ChannelContext; -use crate::ln::features::{ChannelTypeFeatures, InitFeatures}; use crate::ln::msgs::DecodeError; use crate::ln::types::{ChannelId, PaymentHash}; use crate::sign::SignerProvider; +use crate::types::features::{ChannelTypeFeatures, InitFeatures}; 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 bdf67b5da..0ffab3bfe 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -50,9 +50,9 @@ use crate::ln::inbound_payment; use crate::ln::types::{ChannelId, 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::ln::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; +use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; #[cfg(any(feature = "_test_utils", test))] -use crate::ln::features::Bolt11InvoiceFeatures; +use crate::types::features::Bolt11InvoiceFeatures; use crate::routing::router::{BlindedTail, InFlightHtlcs, Path, Payee, PaymentParameters, Route, RouteParameters, Router}; use crate::ln::onion_payment::{check_incoming_htlc_cltv, create_recv_pending_htlc_info, create_fwd_pending_htlc_info, decode_incoming_update_add_htlc_onion, InboundHTLCErr, NextPacketDetails}; use crate::ln::msgs; diff --git a/lightning/src/ln/features.rs b/lightning/src/ln/features.rs index e05fb9c41..8485ca7e6 100644 --- a/lightning/src/ln/features.rs +++ b/lightning/src/ln/features.rs @@ -7,21 +7,12 @@ // You may not use this file except in accordance with one or both of these // licenses. -//! Feature flag definitions for the Lightning protocol according to [BOLT #9]. -//! -//! See [`lightning_types::features`] for the list of features currently supported. -//! -//! Note that the use of types via this module is deprecated and will be removed in a future -//! version. Instead, use feature objects via [`lightning::types::features`]. -//! -//! [`lightning::types::features`]: crate::types::features -//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md - -pub use lightning_types::features::Features; -pub use lightning_types::features::{InitFeatures, NodeFeatures, ChannelFeatures}; -pub use lightning_types::features::{Bolt11InvoiceFeatures, OfferFeatures, InvoiceRequestFeatures}; -pub use lightning_types::features::{Bolt12InvoiceFeatures, BlindedHopFeatures}; -pub use lightning_types::features::ChannelTypeFeatures; +//! Implementations of extensions on features. + +use lightning_types::features::{InitFeatures, NodeFeatures, ChannelFeatures}; +use lightning_types::features::{Bolt11InvoiceFeatures, OfferFeatures, InvoiceRequestFeatures}; +use lightning_types::features::{Bolt12InvoiceFeatures, BlindedHopFeatures}; +use lightning_types::features::ChannelTypeFeatures; #[allow(unused_imports)] use crate::prelude::*; diff --git a/lightning/src/ln/functional_test_utils.rs b/lightning/src/ln/functional_test_utils.rs index 7776966b2..1643be848 100644 --- a/lightning/src/ln/functional_test_utils.rs +++ b/lightning/src/ln/functional_test_utils.rs @@ -17,7 +17,7 @@ use crate::events::{ClaimedHTLC, ClosureReason, Event, HTLCDestination, MessageS use crate::events::bump_transaction::{BumpTransactionEvent, BumpTransactionEventHandler, Wallet, WalletSource}; use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; use crate::ln::channelmanager::{AChannelManager, ChainParameters, ChannelManager, ChannelManagerReadArgs, RAACommitmentOrder, PaymentSendFailure, RecipientOnionFields, PaymentId, MIN_CLTV_EXPIRY_DELTA}; -use crate::ln::features::InitFeatures; +use crate::types::features::InitFeatures; use crate::ln::msgs; use crate::ln::msgs::{ChannelMessageHandler, OnionMessageHandler, RoutingMessageHandler}; use crate::ln::peer_handler::IgnoringMessageHandler; diff --git a/lightning/src/ln/functional_tests.rs b/lightning/src/ln/functional_tests.rs index 31346c6b7..62885409d 100644 --- a/lightning/src/ln/functional_tests.rs +++ b/lightning/src/ln/functional_tests.rs @@ -27,7 +27,7 @@ use crate::ln::{chan_utils, onion_utils}; use crate::ln::chan_utils::{commitment_tx_base_weight, COMMITMENT_TX_WEIGHT_PER_HTLC, OFFERED_HTLC_SCRIPT_WEIGHT, htlc_success_tx_weight, htlc_timeout_tx_weight, HTLCOutputInCommitment}; use crate::routing::gossip::{NetworkGraph, NetworkUpdate}; use crate::routing::router::{Path, PaymentParameters, Route, RouteHop, get_route, RouteParameters}; -use crate::ln::features::{ChannelFeatures, ChannelTypeFeatures, NodeFeatures}; +use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, NodeFeatures}; use crate::ln::msgs; use crate::ln::msgs::{ChannelMessageHandler, RoutingMessageHandler, ErrorAction}; use crate::util::test_channel_signer::TestChannelSigner; diff --git a/lightning/src/ln/max_payment_path_len_tests.rs b/lightning/src/ln/max_payment_path_len_tests.rs index 380fe2198..a6252fd2b 100644 --- a/lightning/src/ln/max_payment_path_len_tests.rs +++ b/lightning/src/ln/max_payment_path_len_tests.rs @@ -17,7 +17,7 @@ use crate::events::{Event, MessageSendEventsProvider}; use crate::ln::PaymentSecret; use crate::ln::blinded_payment_tests::get_blinded_route_parameters; use crate::ln::channelmanager::PaymentId; -use crate::ln::features::BlindedHopFeatures; +use crate::types::features::BlindedHopFeatures; use crate::ln::functional_test_utils::*; use crate::ln::msgs; use crate::ln::msgs::OnionMessageHandler; diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index be5ecb27a..39c998092 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -33,7 +33,7 @@ use bitcoin::hash_types::Txid; use crate::blinded_path::payment::{BlindedPaymentTlvs, ForwardTlvs, ReceiveTlvs}; use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; -use crate::ln::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; +use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; use crate::ln::onion_utils; use crate::onion_message; use crate::sign::{NodeSigner, Recipient}; @@ -1747,7 +1747,7 @@ mod fuzzy_internal_msgs { use bitcoin::secp256k1::PublicKey; use crate::blinded_path::payment::{PaymentConstraints, PaymentContext, PaymentRelay}; use crate::ln::types::{PaymentPreimage, PaymentSecret}; - use crate::ln::features::BlindedHopFeatures; + use crate::types::features::BlindedHopFeatures; use super::{FinalOnionHopData, TrampolineOnionPacket}; #[allow(unused_imports)] @@ -3299,7 +3299,7 @@ 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::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; + use crate::types::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, NodeFeatures}; use crate::ln::msgs::{self, FinalOnionHopData, OnionErrorPacket, CommonOpenChannelFields, CommonAcceptChannelFields, TrampolineOnionPacket}; use crate::ln::msgs::SocketAddress; use crate::routing::gossip::{NodeAlias, NodeId}; diff --git a/lightning/src/ln/offers_tests.rs b/lightning/src/ln/offers_tests.rs index 12b10754e..b667ce2c0 100644 --- a/lightning/src/ln/offers_tests.rs +++ b/lightning/src/ln/offers_tests.rs @@ -49,7 +49,7 @@ use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, Paym use crate::blinded_path::message::{MessageContext, OffersContext}; use crate::events::{ClosureReason, Event, MessageSendEventsProvider, PaymentFailureReason, PaymentPurpose}; use crate::ln::channelmanager::{Bolt12PaymentError, MAX_SHORT_LIVED_RELATIVE_EXPIRY, PaymentId, RecentPaymentDetails, Retry, self}; -use crate::ln::features::Bolt12InvoiceFeatures; +use crate::types::features::Bolt12InvoiceFeatures; use crate::ln::functional_test_utils::*; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::{ChannelMessageHandler, Init, NodeAnnouncement, OnionMessage, OnionMessageHandler, RoutingMessageHandler, SocketAddress, UnsignedGossipMessage, UnsignedNodeAnnouncement}; diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index 3afe50859..457834662 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -13,7 +13,7 @@ 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::ln::channelmanager::{BlindedFailure, BlindedForward, CLTV_FAR_FAR_AWAY, HTLCFailureMsg, MIN_CLTV_EXPIRY_DELTA, PendingHTLCInfo, PendingHTLCRouting}; -use crate::ln::features::BlindedHopFeatures; +use crate::types::features::BlindedHopFeatures; use crate::ln::msgs; use crate::ln::onion_utils; use crate::ln::onion_utils::{HTLCFailReason, INVALID_ONION_BLINDING}; @@ -510,7 +510,7 @@ mod tests { use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; use crate::ln::types::{ChannelId, PaymentPreimage, PaymentHash, PaymentSecret}; use crate::ln::channelmanager::RecipientOnionFields; - use crate::ln::features::{ChannelFeatures, NodeFeatures}; + use crate::types::features::{ChannelFeatures, NodeFeatures}; use crate::ln::msgs; use crate::ln::onion_utils::create_payment_onion; use crate::routing::router::{Path, RouteHop}; diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index 081cca2ef..cad012626 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -20,7 +20,7 @@ use crate::ln::channelmanager::{HTLCForwardInfo, FailureCode, CLTV_FAR_FAR_AWAY, use crate::ln::onion_utils; use crate::routing::gossip::{NetworkUpdate, RoutingFees}; use crate::routing::router::{get_route, PaymentParameters, Route, RouteParameters, RouteHint, RouteHintHop}; -use crate::ln::features::{InitFeatures, Bolt11InvoiceFeatures}; +use crate::types::features::{InitFeatures, Bolt11InvoiceFeatures}; use crate::ln::functional_test_utils::test_default_channel_config; use crate::ln::msgs; use crate::ln::msgs::{ChannelMessageHandler, ChannelUpdate, OutboundTrampolinePayload}; diff --git a/lightning/src/ln/onion_utils.rs b/lightning/src/ln/onion_utils.rs index 5ad684076..33eec9dff 100644 --- a/lightning/src/ln/onion_utils.rs +++ b/lightning/src/ln/onion_utils.rs @@ -12,12 +12,12 @@ use crate::crypto::chacha20::ChaCha20; use crate::crypto::streams::ChaChaReader; use crate::ln::channel::TOTAL_BITCOIN_SUPPLY_SATOSHIS; use crate::ln::channelmanager::{HTLCSource, RecipientOnionFields}; -use crate::ln::features::{ChannelFeatures, NodeFeatures}; 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::util::errors::{self, APIError}; use crate::util::logger::Logger; use crate::util::ser::{LengthCalculatingWriter, Readable, ReadableArgs, Writeable, Writer}; @@ -1270,10 +1270,10 @@ fn decode_next_hop, N: NextPacketBytes>( #[cfg(test)] mod tests { use crate::io; - use crate::ln::features::{ChannelFeatures, NodeFeatures}; use crate::ln::msgs; use crate::ln::types::PaymentHash; use crate::routing::router::{Path, Route, RouteHop}; + use crate::types::features::{ChannelFeatures, NodeFeatures}; 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 2bc1c9b4e..b592ae0c4 100644 --- a/lightning/src/ln/outbound_payment.rs +++ b/lightning/src/ln/outbound_payment.rs @@ -18,7 +18,7 @@ use crate::events::{self, PaymentFailureReason}; use crate::ln::types::{PaymentHash, PaymentPreimage, PaymentSecret}; use crate::ln::channel_state::ChannelDetails; use crate::ln::channelmanager::{EventCompletionAction, HTLCSource, PaymentId}; -use crate::ln::features::Bolt12InvoiceFeatures; +use crate::types::features::Bolt12InvoiceFeatures; use crate::ln::onion_utils; use crate::ln::onion_utils::{DecodedOnionFailure, HTLCFailReason}; use crate::offers::invoice::Bolt12Invoice; @@ -2267,7 +2267,7 @@ mod tests { use crate::events::{Event, PathFailure, PaymentFailureReason}; use crate::ln::types::{PaymentHash, PaymentPreimage}; use crate::ln::channelmanager::{PaymentId, RecipientOnionFields}; - use crate::ln::features::{Bolt12InvoiceFeatures, ChannelFeatures, NodeFeatures}; + use crate::types::features::{Bolt12InvoiceFeatures, ChannelFeatures, NodeFeatures}; use crate::ln::msgs::{ErrorAction, LightningError}; use crate::ln::outbound_payment::{Bolt12PaymentError, OutboundPayments, PendingOutboundPayment, Retry, RetryableSendFailure, StaleExpiration}; #[cfg(feature = "std")] diff --git a/lightning/src/ln/payment_tests.rs b/lightning/src/ln/payment_tests.rs index eac2a35c6..2f6a14e8c 100644 --- a/lightning/src/ln/payment_tests.rs +++ b/lightning/src/ln/payment_tests.rs @@ -17,7 +17,7 @@ use crate::sign::EntropySource; use crate::events::{ClosureReason, Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentFailureReason, PaymentPurpose}; use crate::ln::channel::{EXPIRE_PREV_CONFIG_TICKS, get_holder_selected_channel_reserve_satoshis, ANCHOR_OUTPUT_VALUE_SATOSHI}; use crate::ln::channelmanager::{BREAKDOWN_TIMEOUT, MPP_TIMEOUT_TICKS, MIN_CLTV_EXPIRY_DELTA, PaymentId, PaymentSendFailure, RecentPaymentDetails, RecipientOnionFields, HTLCForwardInfo, PendingHTLCRouting, PendingAddHTLCInfo}; -use crate::ln::features::{Bolt11InvoiceFeatures, ChannelTypeFeatures}; +use crate::types::features::{Bolt11InvoiceFeatures, ChannelTypeFeatures}; use crate::ln::msgs; use crate::ln::types::{ChannelId, PaymentHash, PaymentSecret, PaymentPreimage}; use crate::ln::chan_utils; diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 64c35835b..8f88c4f68 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -22,7 +22,7 @@ use crate::blinded_path::message::{AsyncPaymentsContext, DNSResolverContext, Off use crate::sign::{NodeSigner, Recipient}; use crate::events::{MessageSendEvent, MessageSendEventsProvider}; use crate::ln::types::ChannelId; -use crate::ln::features::{InitFeatures, NodeFeatures}; +use crate::types::features::{InitFeatures, NodeFeatures}; use crate::ln::msgs; use crate::ln::msgs::{ChannelMessageHandler, Init, LightningError, SocketAddress, OnionMessageHandler, RoutingMessageHandler}; use crate::util::ser::{VecWriter, Writeable, Writer}; @@ -2712,7 +2712,7 @@ mod tests { use crate::events; use crate::io; use crate::ln::types::ChannelId; - use crate::ln::features::{InitFeatures, NodeFeatures}; + use crate::types::features::{InitFeatures, NodeFeatures}; use crate::ln::peer_channel_encryptor::PeerChannelEncryptor; use crate::ln::peer_handler::{CustomMessageHandler, PeerManager, MessageHandler, SocketDescriptor, IgnoringMessageHandler, filter_addresses, ErroringMessageHandler, MAX_BUFFER_DRAIN_TICK_INTERVALS_PER_PEER}; use crate::ln::{msgs, wire}; diff --git a/lightning/src/ln/priv_short_conf_tests.rs b/lightning/src/ln/priv_short_conf_tests.rs index 22854952c..beccf59af 100644 --- a/lightning/src/ln/priv_short_conf_tests.rs +++ b/lightning/src/ln/priv_short_conf_tests.rs @@ -17,7 +17,7 @@ use crate::events::{ClosureReason, Event, HTLCDestination, MessageSendEvent, Mes use crate::ln::channelmanager::{MIN_CLTV_EXPIRY_DELTA, PaymentId, RecipientOnionFields}; use crate::routing::gossip::RoutingFees; use crate::routing::router::{PaymentParameters, RouteHint, RouteHintHop}; -use crate::ln::features::ChannelTypeFeatures; +use crate::types::features::ChannelTypeFeatures; use crate::ln::msgs; use crate::ln::types::ChannelId; use crate::ln::msgs::{ChannelMessageHandler, RoutingMessageHandler, ChannelUpdate, ErrorAction}; diff --git a/lightning/src/ln/script.rs b/lightning/src/ln/script.rs index 0c33a1498..518128b66 100644 --- a/lightning/src/ln/script.rs +++ b/lightning/src/ln/script.rs @@ -7,7 +7,7 @@ use bitcoin::hashes::Hash; use bitcoin::secp256k1::PublicKey; use crate::ln::channelmanager; -use crate::ln::features::InitFeatures; +use crate::types::features::InitFeatures; use crate::ln::msgs::DecodeError; use crate::util::ser::{Readable, Writeable, Writer}; @@ -175,7 +175,7 @@ mod shutdown_script_tests { use bitcoin::secp256k1::Secp256k1; use bitcoin::secp256k1::{PublicKey, SecretKey}; - use crate::ln::features::InitFeatures; + use crate::types::features::InitFeatures; use crate::prelude::*; fn pubkey() -> bitcoin::key::PublicKey { diff --git a/lightning/src/offers/invoice.rs b/lightning/src/offers/invoice.rs index 648c0fba6..d1fa54b8f 100644 --- a/lightning/src/offers/invoice.rs +++ b/lightning/src/offers/invoice.rs @@ -115,7 +115,7 @@ use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath}; use crate::ln::types::PaymentHash; use crate::ln::channelmanager::PaymentId; -use crate::ln::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures}; +use crate::types::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}; @@ -1453,7 +1453,7 @@ mod tests { use crate::blinded_path::BlindedHop; use crate::blinded_path::message::BlindedMessagePath; use crate::sign::KeyMaterial; - use crate::ln::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures}; + use crate::types::features::{Bolt12InvoiceFeatures, InvoiceRequestFeatures, OfferFeatures}; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::DecodeError; use crate::offers::invoice_request::InvoiceRequestTlvStreamRef; diff --git a/lightning/src/offers/invoice_request.rs b/lightning/src/offers/invoice_request.rs index c6c9da82a..3fcc50b5e 100644 --- a/lightning/src/offers/invoice_request.rs +++ b/lightning/src/offers/invoice_request.rs @@ -25,7 +25,7 @@ //! //! use bitcoin::network::Network; //! use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, SecretKey}; -//! use lightning::ln::features::OfferFeatures; +//! use lightning::types::features::OfferFeatures; //! use lightning::offers::invoice_request::UnsignedInvoiceRequest; //! use lightning::offers::offer::Offer; //! use lightning::util::ser::Writeable; @@ -66,7 +66,7 @@ use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::BlindedPaymentPath; use crate::ln::types::PaymentHash; use crate::ln::channelmanager::PaymentId; -use crate::ln::features::InvoiceRequestFeatures; +use crate::types::features::InvoiceRequestFeatures; use crate::ln::inbound_payment::{ExpandedKey, IV_LEN}; use crate::ln::msgs::DecodeError; use crate::offers::merkle::{SignError, SignFn, SignatureTlvStream, SignatureTlvStreamRef, TaggedHash, self}; @@ -1252,7 +1252,7 @@ mod tests { use core::time::Duration; use crate::sign::KeyMaterial; use crate::ln::channelmanager::PaymentId; - use crate::ln::features::{InvoiceRequestFeatures, OfferFeatures}; + use crate::types::features::{InvoiceRequestFeatures, OfferFeatures}; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT}; use crate::offers::invoice::{Bolt12Invoice, SIGNATURE_TAG as INVOICE_SIGNATURE_TAG}; diff --git a/lightning/src/offers/offer.rs b/lightning/src/offers/offer.rs index 8501b8d46..6580430fb 100644 --- a/lightning/src/offers/offer.rs +++ b/lightning/src/offers/offer.rs @@ -87,7 +87,7 @@ use core::time::Duration; use crate::io; use crate::blinded_path::message::BlindedMessagePath; use crate::ln::channelmanager::PaymentId; -use crate::ln::features::OfferFeatures; +use crate::types::features::OfferFeatures; use crate::ln::inbound_payment::{ExpandedKey, IV_LEN}; use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT}; use crate::offers::merkle::{TaggedHash, TlvStream}; @@ -603,7 +603,7 @@ macro_rules! offer_accessors { ($self: ident, $contents: expr) => { } /// Features pertaining to the offer. - pub fn offer_features(&$self) -> &$crate::ln::features::OfferFeatures { + pub fn offer_features(&$self) -> &$crate::types::features::OfferFeatures { &$contents.features() } @@ -1191,7 +1191,7 @@ mod tests { use crate::blinded_path::BlindedHop; use crate::blinded_path::message::BlindedMessagePath; use crate::sign::KeyMaterial; - use crate::ln::features::OfferFeatures; + use crate::types::features::OfferFeatures; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT}; use crate::offers::nonce::Nonce; diff --git a/lightning/src/offers/refund.rs b/lightning/src/offers/refund.rs index 482c3b688..8c580bdcc 100644 --- a/lightning/src/offers/refund.rs +++ b/lightning/src/offers/refund.rs @@ -95,7 +95,7 @@ use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::BlindedPaymentPath; use crate::ln::types::PaymentHash; use crate::ln::channelmanager::PaymentId; -use crate::ln::features::InvoiceRequestFeatures; +use crate::types::features::InvoiceRequestFeatures; use crate::ln::inbound_payment::{ExpandedKey, IV_LEN}; use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT}; use crate::offers::invoice_request::{InvoiceRequestTlvStream, InvoiceRequestTlvStreamRef}; @@ -941,7 +941,7 @@ mod tests { use crate::blinded_path::message::BlindedMessagePath; use crate::sign::KeyMaterial; use crate::ln::channelmanager::PaymentId; - use crate::ln::features::{InvoiceRequestFeatures, OfferFeatures}; + use crate::types::features::{InvoiceRequestFeatures, OfferFeatures}; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::{DecodeError, MAX_VALUE_MSAT}; use crate::offers::invoice_request::InvoiceRequestTlvStreamRef; diff --git a/lightning/src/offers/static_invoice.rs b/lightning/src/offers/static_invoice.rs index bf88bd944..107e9c698 100644 --- a/lightning/src/offers/static_invoice.rs +++ b/lightning/src/offers/static_invoice.rs @@ -12,7 +12,6 @@ use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::payment::BlindedPaymentPath; use crate::io; -use crate::ln::features::{Bolt12InvoiceFeatures, OfferFeatures}; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::DecodeError; use crate::offers::invoice::{ @@ -29,6 +28,7 @@ use crate::offers::offer::{ Amount, Offer, OfferContents, OfferTlvStream, OfferTlvStreamRef, Quantity, OFFER_TYPES, }; use crate::offers::parse::{Bolt12ParseError, Bolt12SemanticError, ParsedMessage}; +use crate::types::features::{Bolt12InvoiceFeatures, OfferFeatures}; use crate::util::ser::{CursorReadable, Iterable, WithoutLength, Writeable, Writer}; use crate::util::string::PrintableString; use bitcoin::address::Address; @@ -603,7 +603,6 @@ impl TryFrom for InvoiceContents { mod tests { use crate::blinded_path::message::BlindedMessagePath; use crate::blinded_path::BlindedHop; - use crate::ln::features::{Bolt12InvoiceFeatures, OfferFeatures}; use crate::ln::inbound_payment::ExpandedKey; use crate::ln::msgs::DecodeError; use crate::offers::invoice::InvoiceTlvStreamRef; @@ -617,6 +616,7 @@ mod tests { }; use crate::offers::test_utils::*; use crate::sign::KeyMaterial; + use crate::types::features::{Bolt12InvoiceFeatures, OfferFeatures}; use crate::util::ser::{BigSize, Iterable, Writeable}; use bitcoin::constants::ChainHash; use bitcoin::secp256k1::{self, Secp256k1}; diff --git a/lightning/src/offers/test_utils.rs b/lightning/src/offers/test_utils.rs index 735354cb8..fc6d9f755 100644 --- a/lightning/src/offers/test_utils.rs +++ b/lightning/src/offers/test_utils.rs @@ -17,7 +17,7 @@ use crate::blinded_path::BlindedHop; use crate::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath}; use crate::sign::EntropySource; use crate::ln::types::PaymentHash; -use crate::ln::features::BlindedHopFeatures; +use crate::types::features::BlindedHopFeatures; use crate::offers::merkle::TaggedHash; #[allow(unused_imports)] diff --git a/lightning/src/onion_message/functional_tests.rs b/lightning/src/onion_message/functional_tests.rs index ac79c88fb..23fd30c9e 100644 --- a/lightning/src/onion_message/functional_tests.rs +++ b/lightning/src/onion_message/functional_tests.rs @@ -12,7 +12,7 @@ use crate::blinded_path::EmptyNodeIdLookUp; use crate::blinded_path::message::{AsyncPaymentsContext, BlindedMessagePath, DNSResolverContext, MessageForwardNode, MessageContext, OffersContext}; use crate::events::{Event, EventsProvider}; -use crate::ln::features::{ChannelFeatures, InitFeatures}; +use crate::types::features::{ChannelFeatures, InitFeatures}; use crate::ln::msgs::{self, DecodeError, OnionMessageHandler}; use crate::routing::gossip::{NetworkGraph, P2PGossipSync}; use crate::routing::test_utils::{add_channel, add_or_update_node}; diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index 0d7243193..8162c55ac 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -20,7 +20,7 @@ use crate::blinded_path::message::{BlindedMessagePath, MessageForwardNode, Forwa use crate::blinded_path::utils; use crate::events::{Event, EventHandler, EventsProvider, ReplayEvent}; use crate::sign::{EntropySource, NodeSigner, Recipient}; -use crate::ln::features::{InitFeatures, NodeFeatures}; +use crate::types::features::{InitFeatures, NodeFeatures}; use crate::ln::msgs::{self, OnionMessage, OnionMessageHandler, SocketAddress}; use crate::ln::onion_utils; use crate::routing::gossip::{NetworkGraph, NodeId, ReadOnlyNetworkGraph}; diff --git a/lightning/src/routing/gossip.rs b/lightning/src/routing/gossip.rs index 47d80d86c..474bedfc2 100644 --- a/lightning/src/routing/gossip.rs +++ b/lightning/src/routing/gossip.rs @@ -22,7 +22,6 @@ use bitcoin::hashes::Hash; use bitcoin::network::Network; use crate::events::{MessageSendEvent, MessageSendEventsProvider}; -use crate::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures}; use crate::ln::msgs; use crate::ln::msgs::{ ChannelAnnouncement, ChannelUpdate, GossipTimestampFilter, NodeAnnouncement, @@ -36,6 +35,7 @@ use crate::ln::msgs::{ }; use crate::ln::types::ChannelId; use crate::routing::utxo::{self, UtxoLookup, UtxoResolver}; +use crate::types::features::{ChannelFeatures, InitFeatures, NodeFeatures}; use crate::util::indexed_map::{Entry as IndexedMapEntry, IndexedMap}; use crate::util::logger::{Level, Logger}; use crate::util::scid_utils::{block_from_scid, scid_from_parts, MAX_SCID_BLOCK}; @@ -2683,8 +2683,6 @@ pub(crate) mod tests { use crate::events::{MessageSendEvent, MessageSendEventsProvider}; use crate::ln::chan_utils::make_funding_redeemscript; use crate::ln::channelmanager; - #[cfg(feature = "std")] - use crate::ln::features::InitFeatures; use crate::ln::msgs::SocketAddress; use crate::ln::msgs::{ ChannelAnnouncement, ChannelUpdate, NodeAnnouncement, QueryChannelRange, @@ -2698,6 +2696,8 @@ pub(crate) mod tests { MAX_EXCESS_BYTES_FOR_RELAY, }; use crate::routing::utxo::{UtxoLookupError, UtxoResult}; + #[cfg(feature = "std")] + use crate::types::features::InitFeatures; use crate::util::config::UserConfig; use crate::util::scid_utils::scid_from_parts; use crate::util::ser::{Hostname, Readable, ReadableArgs, Writeable}; diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index b0a3f34a6..9bdacab4b 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -16,7 +16,7 @@ use crate::blinded_path::payment::{BlindedPaymentPath, ForwardTlvs, PaymentConst use crate::ln::{PaymentHash, PaymentPreimage}; use crate::ln::channel_state::ChannelDetails; use crate::ln::channelmanager::{PaymentId, MIN_FINAL_CLTV_EXPIRY_DELTA, RecipientOnionFields}; -use crate::ln::features::{BlindedHopFeatures, Bolt11InvoiceFeatures, Bolt12InvoiceFeatures, ChannelFeatures, NodeFeatures}; +use crate::types::features::{BlindedHopFeatures, Bolt11InvoiceFeatures, Bolt12InvoiceFeatures, ChannelFeatures, NodeFeatures}; use crate::ln::msgs::{DecodeError, ErrorAction, LightningError, MAX_VALUE_MSAT}; use crate::ln::onion_utils; #[cfg(async_payments)] @@ -3548,7 +3548,7 @@ mod tests { use crate::chain::transaction::OutPoint; use crate::ln::channel_state::{ChannelCounterparty, ChannelDetails, ChannelShutdownState}; use crate::ln::types::ChannelId; - use crate::ln::features::{BlindedHopFeatures, ChannelFeatures, InitFeatures, NodeFeatures}; + use crate::types::features::{BlindedHopFeatures, ChannelFeatures, InitFeatures, NodeFeatures}; use crate::ln::msgs::{ErrorAction, LightningError, UnsignedChannelUpdate, MAX_VALUE_MSAT}; use crate::ln::channelmanager; use crate::util::config::UserConfig; @@ -8840,7 +8840,7 @@ pub mod benches { use super::*; use crate::routing::scoring::{ScoreUpdate, ScoreLookUp}; use crate::ln::channelmanager; - use crate::ln::features::Bolt11InvoiceFeatures; + use crate::types::features::Bolt11InvoiceFeatures; use crate::routing::gossip::NetworkGraph; use crate::routing::scoring::{FixedPenaltyScorer, ProbabilisticScoringFeeParameters}; use crate::util::config::UserConfig; diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index b27a9f97b..d155926cb 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -3481,7 +3481,7 @@ pub mod benches { use criterion::Criterion; use crate::routing::router::{bench_utils, RouteHop}; use crate::util::test_utils::TestLogger; - use crate::ln::features::{ChannelFeatures, NodeFeatures}; + use crate::types::features::{ChannelFeatures, NodeFeatures}; pub fn decay_100k_channel_bounds(bench: &mut Criterion) { let logger = TestLogger::new(); diff --git a/lightning/src/routing/test_utils.rs b/lightning/src/routing/test_utils.rs index a64955cd0..f5b752f1a 100644 --- a/lightning/src/routing/test_utils.rs +++ b/lightning/src/routing/test_utils.rs @@ -8,7 +8,7 @@ // licenses. use crate::routing::gossip::{NetworkGraph, NodeAlias, P2PGossipSync}; -use crate::ln::features::{ChannelFeatures, NodeFeatures}; +use crate::types::features::{ChannelFeatures, NodeFeatures}; use crate::ln::msgs::{ChannelAnnouncement, ChannelUpdate, MAX_VALUE_MSAT, NodeAnnouncement, RoutingMessageHandler, SocketAddress, UnsignedChannelAnnouncement, UnsignedChannelUpdate, UnsignedNodeAnnouncement}; use crate::util::test_utils; use crate::util::ser::Writeable; diff --git a/lightning/src/sign/mod.rs b/lightning/src/sign/mod.rs index 8ad34f2d6..c1a70e5e8 100644 --- a/lightning/src/sign/mod.rs +++ b/lightning/src/sign/mod.rs @@ -63,12 +63,12 @@ use crate::util::transaction_utils; use crate::crypto::chacha20::ChaCha20; use crate::io::{self, Error}; -use crate::ln::features::ChannelTypeFeatures; use crate::ln::msgs::DecodeError; use crate::prelude::*; use crate::sign::ecdsa::EcdsaChannelSigner; #[cfg(taproot)] use crate::sign::taproot::TaprootChannelSigner; +use crate::types::features::ChannelTypeFeatures; use crate::util::atomic_counter::AtomicCounter; use core::convert::TryInto; use core::ops::Deref; diff --git a/lightning/src/util/errors.rs b/lightning/src/util/errors.rs index ba423aa1c..7b9a24f89 100644 --- a/lightning/src/util/errors.rs +++ b/lightning/src/util/errors.rs @@ -64,7 +64,7 @@ pub enum APIError { /// a channel or cooperatively close one with this peer (and will have to force-close instead). /// /// [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey - /// [`InitFeatures`]: crate::ln::features::InitFeatures + /// [`InitFeatures`]: crate::types::features::InitFeatures IncompatibleShutdownScript { /// The incompatible shutdown script. script: ShutdownScript, diff --git a/lightning/src/util/test_channel_signer.rs b/lightning/src/util/test_channel_signer.rs index 9aa34fd4c..9a1a75e92 100644 --- a/lightning/src/util/test_channel_signer.rs +++ b/lightning/src/util/test_channel_signer.rs @@ -37,7 +37,7 @@ use musig2::types::{PartialSignature, PublicNonce}; use crate::sign::HTLCDescriptor; use crate::util::ser::{Writeable, Writer}; use crate::io::Error; -use crate::ln::features::ChannelTypeFeatures; +use crate::types::features::ChannelTypeFeatures; #[cfg(taproot)] use crate::ln::msgs::PartialSignatureWithNonce; #[cfg(taproot)] diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 12e027d32..4583bc2e4 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -29,7 +29,7 @@ use crate::ln::channel_state::ChannelDetails; use crate::ln::channelmanager; #[cfg(test)] use crate::ln::chan_utils::CommitmentTransaction; -use crate::ln::features::{ChannelFeatures, InitFeatures, NodeFeatures}; +use crate::types::features::{ChannelFeatures, InitFeatures, NodeFeatures}; use crate::ln::{msgs, wire}; use crate::ln::msgs::LightningError; use crate::ln::script::ShutdownScript; -- 2.39.5