Skip to content

Commit b386313

Browse files
committed
Introduce default_config function
.. this allows us the retrieve a `Config` prepopulated with default values in bindings (where `Default::default()` isn't available), even if it includes complex structures for which we can't set default values in the UDL file.
1 parent e335f0b commit b386313

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

bindings/ldk_node.udl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
namespace ldk_node {
22
Mnemonic generate_entropy_mnemonic();
3+
Config default_config();
34
};
45

56
dictionary Config {
6-
string storage_dir_path = "/tmp/ldk_node/";
7-
string? log_dir_path = null;
8-
Network network = "Bitcoin";
9-
sequence<SocketAddress>? listening_addresses = null;
10-
u32 default_cltv_expiry_delta = 144;
11-
u64 onchain_wallet_sync_interval_secs = 80;
12-
u64 wallet_sync_interval_secs = 30;
13-
u64 fee_rate_cache_update_interval_secs = 600;
14-
sequence<PublicKey> trusted_peers_0conf = [];
15-
u64 probing_liquidity_limit_multiplier = 3;
16-
LogLevel log_level = "Debug";
7+
string storage_dir_path;
8+
string? log_dir_path;
9+
Network network;
10+
sequence<SocketAddress>? listening_addresses;
11+
u32 default_cltv_expiry_delta;
12+
u64 onchain_wallet_sync_interval_secs;
13+
u64 wallet_sync_interval_secs;
14+
u64 fee_rate_cache_update_interval_secs;
15+
sequence<PublicKey> trusted_peers_0conf;
16+
u64 probing_liquidity_limit_multiplier;
17+
LogLevel log_level;
1718
};
1819

1920
interface Builder {

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@ impl Default for Config {
278278
}
279279
}
280280

281+
/// Returns a [`Config`] object with default values.
282+
pub fn default_config() -> Config {
283+
Config::default()
284+
}
285+
281286
/// The main interface object of LDK Node, wrapping the necessary LDK and BDK functionalities.
282287
///
283288
/// Needs to be initialized and instantiated through [`Builder::build`].

0 commit comments

Comments
 (0)