Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,14 +644,13 @@ impl NodeBuilder {
/// # #[cfg(not(feature = "uniffi"))]
/// # {
/// use std::time::Duration;
/// use ldk_node::Builder;
///
/// use ldk_node::probing::ProbingConfigBuilder;
/// use ldk_node::Builder;
///
/// let mut builder = Builder::new();
/// builder.set_probing_config(
/// ProbingConfigBuilder::high_degree(100)
/// .interval(Duration::from_secs(30))
/// .build()
/// ProbingConfigBuilder::high_degree(100).interval(Duration::from_secs(30)).build(),
/// );
/// # }
/// ```
Expand Down
3 changes: 2 additions & 1 deletion src/payment/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,9 +926,10 @@ mod tests {

#[test]
fn known_onchain_tx_type_survives_unknown_update() {
use bitcoin::hashes::Hash;
use std::str::FromStr;

use bitcoin::hashes::Hash;

let txid = Txid::from_byte_array([8u8; 32]);
let payment_id = PaymentId(txid.to_byte_array());
let pubkey = PublicKey::from_str(
Expand Down
42 changes: 22 additions & 20 deletions src/probing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
//! # #[cfg(not(feature = "uniffi"))]
//! # {
//! use std::time::Duration;
//! use ldk_node::Builder;
//!
//! use ldk_node::probing::ProbingConfigBuilder;
//! use ldk_node::Builder;
//!
//! let probing_config = ProbingConfigBuilder::high_degree(100)
//! .interval(Duration::from_secs(30))
//! .max_locked_msat(500_000)
//! .diversity_penalty_msat(250)
//! .build();
//! .interval(Duration::from_secs(30))
//! .max_locked_msat(500_000)
//! .diversity_penalty_msat(250)
//! .build();
//!
//! let mut builder = Builder::new();
//! builder.set_probing_config(probing_config);
Expand Down Expand Up @@ -70,9 +71,9 @@ use std::time::{Duration, Instant};
use bitcoin::secp256k1::PublicKey;
use lightning::ln::channelmanager::{PaymentId, RecentPaymentDetails};
use lightning::routing::gossip::NodeId;
use lightning::routing::router::Router as LdkRouter;
use lightning::routing::router::{
Path, PaymentParameters, RouteHop, RouteParameters, MAX_PATH_LENGTH_ESTIMATE,
Path, PaymentParameters, RouteHop, RouteParameters, Router as LdkRouter,
MAX_PATH_LENGTH_ESTIMATE,
};
use lightning_invoice::DEFAULT_MIN_FINAL_CLTV_EXPIRY_DELTA;
use lightning_types::features::{ChannelFeatures, NodeFeatures};
Expand Down Expand Up @@ -123,14 +124,15 @@ impl fmt::Debug for ProbingStrategyKind {
/// # #[cfg(not(feature = "uniffi"))]
/// # {
/// use std::time::Duration;
/// use ldk_node::Builder;
///
/// use ldk_node::probing::ProbingConfigBuilder;
/// use ldk_node::Builder;
///
/// let config = ProbingConfigBuilder::high_degree(100)
/// .interval(Duration::from_secs(30))
/// .max_locked_msat(500_000)
/// .diversity_penalty_msat(250)
/// .build();
/// .interval(Duration::from_secs(30))
/// .max_locked_msat(500_000)
/// .diversity_penalty_msat(250)
/// .build();
///
/// let mut builder = Builder::new();
/// builder.set_probing_config(config);
Expand All @@ -143,16 +145,16 @@ impl fmt::Debug for ProbingStrategyKind {
/// use ldk_node::probing::ProbingStrategy;
///
/// struct FixedPathStrategy {
/// path: Path,
/// path: Path,
/// }
/// impl ProbingStrategy for FixedPathStrategy {
/// fn next_probe(&self) -> Option<Path> {
/// if self.path.hops.len() > 1 {
/// Some(self.path.clone())
/// } else {
/// None
/// }
/// }
/// fn next_probe(&self) -> Option<Path> {
/// if self.path.hops.len() > 1 {
/// Some(self.path.clone())
/// } else {
/// None
/// }
/// }
/// }
/// ```
#[derive(Clone, Debug)]
Expand Down
7 changes: 2 additions & 5 deletions tests/probing_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,19 @@

mod common;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::time::Duration;

use common::{
expect_channel_ready_event, expect_event, generate_blocks_and_wait, open_channel,
premine_and_distribute_funds, random_chain_source, random_config, setup_bitcoind_and_electrsd,
setup_node, wait_for_channel_ready_to_send, TestNode, TestStoreType,
};

use ldk_node::bitcoin::Amount;
use ldk_node::probing::{ProbingConfigBuilder, ProbingStrategy};
use ldk_node::Event;

use lightning::routing::router::Path;

use std::sync::{Arc, Mutex};
use std::time::Duration;

const PROBE_AMOUNT_MSAT: u64 = 1_000_000;
const PROBING_INTERVAL_MILLISECONDS: u64 = 100;

Expand Down