Skip to content

Commit

Permalink
Merge pull request #79 from Oscar-Pepper/remove_start_mempool_helper
Browse files Browse the repository at this point in the history
Remove start mempool helper
  • Loading branch information
idky137 authored Oct 18, 2024
2 parents 6093c45 + f138311 commit c5589f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
16 changes: 7 additions & 9 deletions integration-tests/tests/integrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
#![forbid(unsafe_code)]

use std::sync::{atomic::AtomicBool, Arc};
use zaino_testutils::{
drop_test_manager,
zingo_lightclient::{get_address, start_mempool_monitor},
TestManager,
};
use zaino_testutils::{drop_test_manager, zingo_lightclient::get_address, TestManager};

mod wallet_basic {
use zingolib::testutils::lightclient::from_inputs;
use zingolib::{lightclient::LightClient, testutils::lightclient::from_inputs};

use super::*;

Expand Down Expand Up @@ -279,7 +275,7 @@ mod wallet_basic {
let online = Arc::new(AtomicBool::new(true));
let (test_manager, regtest_handler, _indexer_handler) =
TestManager::launch(online.clone()).await;
let zingo_client = test_manager.build_lightclient().await;
let zingo_client = Arc::new(test_manager.build_lightclient().await);

test_manager.regtest_manager.generate_n_blocks(1).unwrap();
zingo_client.do_sync(false).await.unwrap();
Expand All @@ -296,14 +292,16 @@ mod wallet_basic {
.await
.unwrap();

start_mempool_monitor(&zingo_client).await;
zingo_client.clear_state().await;
LightClient::start_mempool_monitor(zingo_client.clone());
tokio::time::sleep(std::time::Duration::from_secs(5)).await;

let balance = zingo_client.do_balance().await;
println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance);
assert_eq!(balance.unverified_sapling_balance.unwrap(), 500_000);

test_manager.regtest_manager.generate_n_blocks(1).unwrap();
zingo_client.do_sync(false).await.unwrap();
zingo_client.do_rescan().await.unwrap();
let balance = zingo_client.do_balance().await;
println!("[TEST LOG] zingo_client balance: \n{:#?}.", balance);
assert_eq!(balance.verified_sapling_balance.unwrap(), 500_000);
Expand Down
16 changes: 0 additions & 16 deletions zaino-testutils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,4 @@ pub mod zingo_lightclient {
) -> String {
zingolib::get_base_address_macro!(zingo_client, pool)
}

/// Starts Zingolib::lightclients's mempool monitor.
pub async fn start_mempool_monitor(zingo_client: &zingolib::lightclient::LightClient) {
let zingo_client_saved = zingo_client.export_save_buffer_async().await.unwrap();
let zingo_client_loaded = std::sync::Arc::new(
zingolib::lightclient::LightClient::read_wallet_from_buffer_async(
zingo_client.config(),
&zingo_client_saved[..],
)
.await
.unwrap(),
);
zingolib::lightclient::LightClient::start_mempool_monitor(zingo_client_loaded.clone());
// This seems to be long enough for the mempool monitor to kick in (from zingolib).
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
}
}

0 comments on commit c5589f0

Please sign in to comment.