Skip to content

Update config defaults and expose them in bindings #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 20, 2023
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
18 changes: 9 additions & 9 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ namespace ldk_node {
};

dictionary Config {
string storage_dir_path;
Network network;
NetAddress? listening_address;
u32 default_cltv_expiry_delta;
u64 onchain_wallet_sync_interval_secs;
u64 wallet_sync_interval_secs;
u64 fee_rate_cache_update_interval_secs;
LogLevel log_level;
sequence<PublicKey> trusted_peers_0conf;
string storage_dir_path = "/tmp/ldk_node/";
Network network = "Bitcoin";
NetAddress? listening_address = 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;
LogLevel log_level = "Debug";
sequence<PublicKey> trusted_peers_0conf = [];
};

interface Builder {
Expand Down
21 changes: 10 additions & 11 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,18 @@ uniffi::include_scaffolding!("ldk_node");
// Config defaults
const DEFAULT_STORAGE_DIR_PATH: &str = "/tmp/ldk_node/";
const DEFAULT_NETWORK: Network = Network::Bitcoin;
const DEFAULT_LISTENING_ADDR: &str = "0.0.0.0:9735";
const DEFAULT_CLTV_EXPIRY_DELTA: u32 = 144;
const DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS: u64 = 60;
const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 20;
const DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS: u64 = 80;
const DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS: u64 = 30;
const DEFAULT_FEE_RATE_CACHE_UPDATE_INTERVAL_SECS: u64 = 60 * 10;
const DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Debug;

// The 'stop gap' parameter used by BDK's wallet sync. This seems to configure the threshold
// number of blocks after which BDK stops looking for scripts belonging to the wallet.
// number of derivation indexes after which BDK stops looking for new scripts belonging to the wallet.
const BDK_CLIENT_STOP_GAP: usize = 20;

// The number of concurrent requests made against the API provider.
const BDK_CLIENT_CONCURRENCY: u8 = 8;
const BDK_CLIENT_CONCURRENCY: u8 = 4;

// The default Esplora server we're using.
const DEFAULT_ESPLORA_SERVER_URL: &str = "https://blockstream.info/api";
Expand Down Expand Up @@ -206,14 +205,14 @@ const WALLET_KEYS_SEED_LEN: usize = 64;
/// | Parameter | Value |
/// |----------------------------------------|------------------|
/// | `storage_dir_path` | /tmp/ldk_node/ |
/// | `network` | `Bitcoin |
/// | `listening_address` | 0.0.0.0:9735 |
/// | `network` | Bitcoin |
/// | `listening_address` | None |
/// | `default_cltv_expiry_delta` | 144 |
/// | `onchain_wallet_sync_interval_secs` | 60 |
/// | `wallet_sync_interval_secs` | 20 |
/// | `onchain_wallet_sync_interval_secs` | 80 |
/// | `wallet_sync_interval_secs` | 30 |
/// | `fee_rate_cache_update_interval_secs` | 600 |
/// | `trusted_peers_0conf` | [] |
/// | `log_level` | `Debug` |
/// | `log_level` | Debug |
///
pub struct Config {
/// The path where the underlying LDK and BDK persist their data.
Expand Down Expand Up @@ -253,7 +252,7 @@ impl Default for Config {
Self {
storage_dir_path: DEFAULT_STORAGE_DIR_PATH.to_string(),
network: DEFAULT_NETWORK,
listening_address: Some(DEFAULT_LISTENING_ADDR.parse().unwrap()),
listening_address: None,
default_cltv_expiry_delta: DEFAULT_CLTV_EXPIRY_DELTA,
onchain_wallet_sync_interval_secs: DEFAULT_BDK_WALLET_SYNC_INTERVAL_SECS,
wallet_sync_interval_secs: DEFAULT_LDK_WALLET_SYNC_INTERVAL_SECS,
Expand Down