From 68d545d1f82ba0d0e64980d056dc16ee7f00d457 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Fri, 26 Apr 2024 14:58:00 -0500 Subject: [PATCH 1/2] Enable anchor channels and scid aliases --- mutiny-core/src/node.rs | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/mutiny-core/src/node.rs b/mutiny-core/src/node.rs index 7e641aeff..99985ccd9 100644 --- a/mutiny-core/src/node.rs +++ b/mutiny-core/src/node.rs @@ -1781,15 +1781,7 @@ impl Node { .lsp_client .as_ref() .is_some_and(|l| l.accept_underpaying_htlcs()); - let mut config = default_user_config(accept_underpaying_htlcs); - - // if we are opening channel to LSP, turn off SCID alias until CLN is updated - // LSP protects all invoice information anyways, so no UTXO leakage - if let Some(lsp) = self.lsp_client.clone() { - if pubkey == lsp.get_lsp_pubkey().await { - config.channel_handshake_config.negotiate_scid_privacy = false; - } - } + let config = default_user_config(accept_underpaying_htlcs); let user_channel_id = user_channel_id.unwrap_or_else(|| { // generate random user channel id @@ -1890,14 +1882,7 @@ impl Node { .lsp_client .as_ref() .is_some_and(|l| l.accept_underpaying_htlcs()); - let mut config = default_user_config(accept_underpaying_htlcs); - // if we are opening channel to LSP, turn off SCID alias until CLN is updated - // LSP protects all invoice information anyways, so no UTXO leakage - if let Some(lsp) = self.lsp_client.clone() { - if pubkey == lsp.get_lsp_pubkey().await { - config.channel_handshake_config.negotiate_scid_privacy = false; - } - } + let config = default_user_config(accept_underpaying_htlcs); let user_channel_id = user_chan_id.unwrap_or_else(|| { // generate random user channel id @@ -2364,7 +2349,7 @@ pub(crate) fn default_user_config(accept_underpaying_htlcs: bool) -> UserConfig announced_channel: false, negotiate_scid_privacy: true, commit_upfront_shutdown_pubkey: false, - negotiate_anchors_zero_fee_htlc_tx: false, + negotiate_anchors_zero_fee_htlc_tx: true, // enable anchor channels max_inbound_htlc_value_in_flight_percent_of_channel: 100, our_to_self_delay: 6 * 24 * 2, // 2 days their_channel_reserve_proportional_millionths: 0, From c360af29db5319c95e424b647c45245b258522f6 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Sat, 27 Apr 2024 11:34:05 -0500 Subject: [PATCH 2/2] Improvements for regtest testing --- mutiny-core/Cargo.toml | 8 ++++---- mutiny-core/src/lib.rs | 6 ++++++ mutiny-core/src/nodemanager.rs | 10 ++++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/mutiny-core/Cargo.toml b/mutiny-core/Cargo.toml index c222ddad5..645a82d52 100644 --- a/mutiny-core/Cargo.toml +++ b/mutiny-core/Cargo.toml @@ -17,9 +17,9 @@ lnurl-rs = { version = "0.4.0", default-features = false, features = ["async", " cfg-if = "1.0.0" bip39 = { version = "2.0.0" } bitcoin = { version = "0.30.2", default-features = false, features = ["std", "serde", "secp-recovery", "rand"] } -bdk = { version = "1.0.0-alpha.5" } -bdk_esplora = { version = "0.7.0", default-features = false, features = ["std", "async-https"] } -bdk_chain = { version = "0.9.0", features = ["std"] } +bdk = { version = "=1.0.0-alpha.5" } +bdk_esplora = { version = "=0.7.0", default-features = false, features = ["std", "async-https"] } +bdk_chain = { version = "=0.9.0", features = ["std"] } bdk-macros = "0.6.0" getrandom = { version = "0.2" } itertools = "0.11.0" @@ -64,7 +64,7 @@ base64 = "0.13.0" pbkdf2 = "0.11" aes-gcm = "0.10.1" -log = "=0.4.18" +log = "0.4.18" futures = "0.3.25" thiserror = "1.0" anyhow = "1.0" diff --git a/mutiny-core/src/lib.rs b/mutiny-core/src/lib.rs index 52a209518..1a4b33bb8 100644 --- a/mutiny-core/src/lib.rs +++ b/mutiny-core/src/lib.rs @@ -46,6 +46,12 @@ mod test_utils; pub use crate::gossip::{GOSSIP_SYNC_TIME_KEY, NETWORK_GRAPH_KEY, PROB_SCORER_KEY}; pub use crate::keymanager::generate_seed; pub use crate::ldkstorage::{CHANNEL_CLOSURE_PREFIX, CHANNEL_MANAGER_KEY, MONITORS_PREFIX_KEY}; +pub use bitcoin; +pub use fedimint_core; +pub use lightning; +pub use lightning_invoice; +pub use nostr_sdk; + use crate::utils::spawn; use crate::{auth::MutinyAuthClient, hermes::HermesClient, logging::MutinyLogger}; use crate::{blindauth::BlindAuthClient, cashu::CashuHttpClient}; diff --git a/mutiny-core/src/nodemanager.rs b/mutiny-core/src/nodemanager.rs index 767c8a408..dd891a2ae 100644 --- a/mutiny-core/src/nodemanager.rs +++ b/mutiny-core/src/nodemanager.rs @@ -579,6 +579,12 @@ impl NodeManager { /// Creates a background process that will sync the wallet with the blockchain. /// This will also update the fee estimates every 10 minutes. pub fn start_sync(nm: Arc>) { + // sync every second on regtest, this makes testing easier + let sync_interval_secs = match nm.network { + Network::Bitcoin | Network::Testnet | Network::Signet => 60, + Network::Regtest => 1, + net => unreachable!("Unknown network: {net}"), + }; utils::spawn(async move { let mut synced = false; loop { @@ -617,8 +623,8 @@ impl NodeManager { synced = true; } - // sleep for 1 minute, checking graceful shutdown check each 1s. - for _ in 0..60 { + // wait for next sync round, checking graceful shutdown check each second. + for _ in 0..sync_interval_secs { if nm.stop.load(Ordering::Relaxed) { return; }