From 2c663c7a7e2a2ad637b603dee84b88a6ce41022f Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Tue, 5 Mar 2024 13:48:19 +0100 Subject: [PATCH] Move `payment_store` to `payment` submodule .. which declutters our top-level docs a bit. --- src/builder.rs | 2 +- src/event.rs | 2 +- src/lib.rs | 11 ++++++----- src/payment/bolt11.rs | 2 +- src/payment/mod.rs | 4 +++- src/{ => payment}/payment_store.rs | 0 src/payment/spontaneous.rs | 4 +++- src/uniffi_types.rs | 2 ++ tests/common.rs | 5 ++--- 9 files changed, 19 insertions(+), 13 deletions(-) rename src/{ => payment}/payment_store.rs (100%) diff --git a/src/builder.rs b/src/builder.rs index 5fb3a8e32..18c2bda41 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -11,7 +11,7 @@ use crate::io::sqlite_store::SqliteStore; use crate::liquidity::LiquiditySource; use crate::logger::{log_error, FilesystemLogger, Logger}; use crate::message_handler::NodeCustomMessageHandler; -use crate::payment_store::PaymentStore; +use crate::payment::payment_store::PaymentStore; use crate::peer_store::PeerStore; use crate::sweep::OutputSweeper; use crate::tx_broadcaster::TransactionBroadcaster; diff --git a/src/event.rs b/src/event.rs index 36048e4d6..f5d5be77d 100644 --- a/src/event.rs +++ b/src/event.rs @@ -3,7 +3,7 @@ use crate::{ hex_utils, ChannelManager, Config, Error, NetworkGraph, PeerInfo, PeerStore, UserChannelId, }; -use crate::payment_store::{ +use crate::payment::payment_store::{ PaymentDetails, PaymentDetailsUpdate, PaymentDirection, PaymentStatus, PaymentStore, }; diff --git a/src/lib.rs b/src/lib.rs index dc7c9b61a..cacaaa7a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,7 +89,6 @@ mod liquidity; mod logger; mod message_handler; pub mod payment; -mod payment_store; mod peer_store; mod sweep; mod tx_broadcaster; @@ -130,9 +129,10 @@ use connection::ConnectionManager; use event::{EventHandler, EventQueue}; use gossip::GossipSource; use liquidity::LiquiditySource; -use payment::{Bolt11PaymentHandler, OnchainPaymentHandler, SpontaneousPaymentHandler}; -use payment_store::PaymentStore; -pub use payment_store::{LSPFeeLimits, PaymentDetails, PaymentDirection, PaymentStatus}; +use payment::payment_store::PaymentStore; +use payment::{ + Bolt11PaymentHandler, OnchainPaymentHandler, PaymentDetails, SpontaneousPaymentHandler, +}; use peer_store::{PeerInfo, PeerStore}; use types::{ Broadcaster, ChainMonitor, ChannelManager, DynStore, FeeEstimator, KeysManager, NetworkGraph, @@ -1091,7 +1091,8 @@ impl Node { /// /// For example, you could retrieve all stored outbound payments as follows: /// ``` - /// # use ldk_node::{Builder, Config, PaymentDirection}; + /// # use ldk_node::{Builder, Config}; + /// # use ldk_node::payment::PaymentDirection; /// # use ldk_node::bitcoin::Network; /// # let mut config = Config::default(); /// # config.network = Network::Regtest; diff --git a/src/payment/bolt11.rs b/src/payment/bolt11.rs index a1204ee02..00f68fcbc 100644 --- a/src/payment/bolt11.rs +++ b/src/payment/bolt11.rs @@ -7,7 +7,7 @@ use crate::connection::ConnectionManager; use crate::error::Error; use crate::liquidity::LiquiditySource; use crate::logger::{log_error, log_info, FilesystemLogger, Logger}; -use crate::payment_store::{ +use crate::payment::payment_store::{ LSPFeeLimits, PaymentDetails, PaymentDirection, PaymentStatus, PaymentStore, }; use crate::peer_store::{PeerInfo, PeerStore}; diff --git a/src/payment/mod.rs b/src/payment/mod.rs index 753e3a481..1a7e5bb00 100644 --- a/src/payment/mod.rs +++ b/src/payment/mod.rs @@ -1,9 +1,11 @@ -//! Handlers for different types of payments. +//! Objects for different types of payments. mod bolt11; mod onchain; +pub(crate) mod payment_store; mod spontaneous; pub use bolt11::Bolt11PaymentHandler; pub use onchain::OnchainPaymentHandler; +pub use payment_store::{LSPFeeLimits, PaymentDetails, PaymentDirection, PaymentStatus}; pub use spontaneous::SpontaneousPaymentHandler; diff --git a/src/payment_store.rs b/src/payment/payment_store.rs similarity index 100% rename from src/payment_store.rs rename to src/payment/payment_store.rs diff --git a/src/payment/spontaneous.rs b/src/payment/spontaneous.rs index cb158ba58..5b5295a3f 100644 --- a/src/payment/spontaneous.rs +++ b/src/payment/spontaneous.rs @@ -3,7 +3,9 @@ use crate::config::{Config, LDK_PAYMENT_RETRY_TIMEOUT}; use crate::error::Error; use crate::logger::{log_error, log_info, FilesystemLogger, Logger}; -use crate::payment_store::{PaymentDetails, PaymentDirection, PaymentStatus, PaymentStore}; +use crate::payment::payment_store::{ + PaymentDetails, PaymentDirection, PaymentStatus, PaymentStore, +}; use crate::types::{ChannelManager, KeysManager}; use lightning::ln::channelmanager::{PaymentId, RecipientOnionFields, Retry, RetryableSendFailure}; diff --git a/src/uniffi_types.rs b/src/uniffi_types.rs index 7204f67f1..9cc901fbf 100644 --- a/src/uniffi_types.rs +++ b/src/uniffi_types.rs @@ -1,3 +1,5 @@ +pub use crate::payment::payment_store::{LSPFeeLimits, PaymentDirection, PaymentStatus}; + pub use lightning::events::{ClosureReason, PaymentFailureReason}; pub use lightning::ln::{ChannelId, PaymentHash, PaymentPreimage, PaymentSecret}; pub use lightning::util::string::UntrustedString; diff --git a/tests/common.rs b/tests/common.rs index b4db81808..3cfe67da7 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -2,9 +2,8 @@ #![allow(dead_code)] use ldk_node::io::sqlite_store::SqliteStore; -use ldk_node::{ - Builder, Config, Event, LogLevel, Node, NodeError, PaymentDirection, PaymentStatus, -}; +use ldk_node::payment::{PaymentDirection, PaymentStatus}; +use ldk_node::{Builder, Config, Event, LogLevel, Node, NodeError}; use lightning::ln::msgs::SocketAddress; use lightning::util::persist::KVStore;