Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit cc1028b

Browse files
committed
Improvements for regtest testing
1 parent cc1226d commit cc1028b

File tree

3 files changed

+18
-6
lines changed

3 files changed

+18
-6
lines changed

mutiny-core/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ lnurl-rs = { version = "0.4.0", default-features = false, features = ["async", "
1717
cfg-if = "1.0.0"
1818
bip39 = { version = "2.0.0" }
1919
bitcoin = { version = "0.30.2", default-features = false, features = ["std", "serde", "secp-recovery", "rand"] }
20-
bdk = { version = "1.0.0-alpha.5" }
21-
bdk_esplora = { version = "0.7.0", default-features = false, features = ["std", "async-https"] }
22-
bdk_chain = { version = "0.9.0", features = ["std"] }
20+
bdk = { version = "=1.0.0-alpha.5" }
21+
bdk_esplora = { version = "=0.7.0", default-features = false, features = ["std", "async-https"] }
22+
bdk_chain = { version = "=0.9.0", features = ["std"] }
2323
bdk-macros = "0.6.0"
2424
getrandom = { version = "0.2" }
2525
itertools = "0.11.0"
@@ -64,7 +64,7 @@ base64 = "0.13.0"
6464
pbkdf2 = "0.11"
6565
aes-gcm = "0.10.1"
6666

67-
log = "=0.4.18"
67+
log = "0.4.18"
6868
futures = "0.3.25"
6969
thiserror = "1.0"
7070
anyhow = "1.0"

mutiny-core/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ mod test_utils;
4646
pub use crate::gossip::{GOSSIP_SYNC_TIME_KEY, NETWORK_GRAPH_KEY, PROB_SCORER_KEY};
4747
pub use crate::keymanager::generate_seed;
4848
pub use crate::ldkstorage::{CHANNEL_CLOSURE_PREFIX, CHANNEL_MANAGER_KEY, MONITORS_PREFIX_KEY};
49+
pub use bitcoin;
50+
pub use fedimint_core;
51+
pub use lightning;
52+
pub use lightning_invoice;
53+
pub use nostr_sdk;
54+
4955
use crate::storage::{
5056
get_payment_hash_from_key, list_payment_info, persist_payment_info, update_nostr_contact_list,
5157
IndexItem, MutinyStorage, DEVICE_ID_KEY, EXPECTED_NETWORK_KEY, NEED_FULL_SYNC_KEY,

mutiny-core/src/nodemanager.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,12 @@ impl<S: MutinyStorage> NodeManager<S> {
579579
/// Creates a background process that will sync the wallet with the blockchain.
580580
/// This will also update the fee estimates every 10 minutes.
581581
pub fn start_sync(nm: Arc<NodeManager<S>>) {
582+
// sync every 5 seconds on regtest, this makes testing easier
583+
let sync_interval_secs = match nm.network {
584+
Network::Bitcoin | Network::Testnet | Network::Signet => 60,
585+
Network::Regtest => 5,
586+
net => unreachable!("Unknown network: {net}"),
587+
};
582588
utils::spawn(async move {
583589
let mut synced = false;
584590
loop {
@@ -617,8 +623,8 @@ impl<S: MutinyStorage> NodeManager<S> {
617623
synced = true;
618624
}
619625

620-
// sleep for 1 minute, checking graceful shutdown check each 1s.
621-
for _ in 0..60 {
626+
// wait for next sync round, checking graceful shutdown check each second.
627+
for _ in 0..sync_interval_secs {
622628
if nm.stop.load(Ordering::Relaxed) {
623629
return;
624630
}

0 commit comments

Comments
 (0)