Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ class AndroidLibTest {
val listenAddress1 = "127.0.0.1:2323"
val listenAddress2 = "127.0.0.1:2324"

val config1 = Config()
val config1 = defaultConfig()
config1.storageDirPath = tmpDir1
config1.listeningAddresses = listOf(listenAddress1)
config1.network = Network.REGTEST
config1.logLevel = LogLevel.TRACE

val config2 = Config()
val config2 = defaultConfig()
config2.storageDirPath = tmpDir2
config2.listeningAddresses = listOf(listenAddress2)
config2.network = Network.REGTEST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ class LibraryTest {
val listenAddress1 = "127.0.0.1:2323"
val listenAddress2 = "127.0.0.1:2324"

val config1 = Config()
val config1 = defaultConfig()
config1.storageDirPath = tmpDir1
config1.listeningAddresses = listOf(listenAddress1)
config1.network = Network.REGTEST
config1.logLevel = LogLevel.TRACE

println("Config 1: $config1")

val config2 = Config()
val config2 = defaultConfig()
config2.storageDirPath = tmpDir2
config2.listeningAddresses = listOf(listenAddress2)
config2.network = Network.REGTEST
Expand Down
23 changes: 12 additions & 11 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
namespace ldk_node {
Mnemonic generate_entropy_mnemonic();
Config default_config();
};

dictionary Config {
string storage_dir_path = "/tmp/ldk_node/";
string? log_dir_path = null;
Network network = "Bitcoin";
sequence<SocketAddress>? listening_addresses = null;
u32 default_cltv_expiry_delta = 144;
u64 onchain_wallet_sync_interval_secs = 80;
u64 wallet_sync_interval_secs = 30;
u64 fee_rate_cache_update_interval_secs = 600;
sequence<PublicKey> trusted_peers_0conf = [];
u64 probing_liquidity_limit_multiplier = 3;
LogLevel log_level = "Debug";
string storage_dir_path;
string? log_dir_path;
Network network;
sequence<SocketAddress>? listening_addresses;
u32 default_cltv_expiry_delta;
u64 onchain_wallet_sync_interval_secs;
u64 wallet_sync_interval_secs;
u64 fee_rate_cache_update_interval_secs;
sequence<PublicKey> trusted_peers_0conf;
u64 probing_liquidity_limit_multiplier;
LogLevel log_level;
};

interface Builder {
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/ldk_node/test_ldk_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def send_to_address(address, amount_sats):


def setup_node(tmp_dir, esplora_endpoint, listening_addresses):
config = Config()
config = default_config()
builder = Builder.from_config(config)
builder.set_storage_dir_path(tmp_dir)
builder.set_esplora_server(esplora_endpoint)
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,16 @@ impl Default for Config {
}
}

/// Returns a [`Config`] object populated with default values.
///
/// See the documentation of [`Config`] for more information on the used defaults.
///
/// This is mostly meant for use in bindings, in Rust this is synonymous with
/// [`Config::default()`].
pub fn default_config() -> Config {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be "uniffi" flagged?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, good question. I debated that in my head to for a bit, I currently left it exposed in Rust too as the Rust docs are the only discoverable docs we have currently. It might be confusing if we'd only expose this in bindings.

I have no super strong opinion on this though.

Config::default()
}

/// The main interface object of LDK Node, wrapping the necessary LDK and BDK functionalities.
///
/// Needs to be initialized and instantiated through [`Builder::build`].
Expand Down