From cce4a1cfb5285057378c85dea73e2f3dd3957cdb Mon Sep 17 00:00:00 2001 From: Oscar Pepper Date: Tue, 17 Oct 2023 16:03:05 +0100 Subject: [PATCH 1/2] updated tests and scenarios to mine orchard by default and refactored create zcash conf --- zingo-testutils/src/lib.rs | 133 +++++++++--------------- zingocli/tests/integration_tests.rs | 150 +++++++++++++++------------- zingolib/src/wallet.rs | 4 +- 3 files changed, 133 insertions(+), 154 deletions(-) diff --git a/zingo-testutils/src/lib.rs b/zingo-testutils/src/lib.rs index 9b4c0908f..7df62e134 100644 --- a/zingo-testutils/src/lib.rs +++ b/zingo-testutils/src/lib.rs @@ -237,22 +237,23 @@ pub mod scenarios { use self::setup::ClientBuilder; use super::regtest::{ChildProcessHandler, RegtestManager}; use crate::{ - data::{ - self, seeds::HOSPITAL_MUSEUM_SEED, REG_T_ADDR_FROM_ABANDONART, - REG_Z_ADDR_FROM_ABANDONART, - }, + data::{self, seeds::HOSPITAL_MUSEUM_SEED}, increase_height_and_wait_for_client, BASE_HEIGHT, }; use zingolib::{get_base_address, lightclient::LightClient, wallet::Pool}; pub mod setup { - use crate::data::{seeds, REG_Z_ADDR_FROM_ABANDONART}; + use crate::data::{ + seeds, REG_O_ADDR_FROM_ABANDONART, REG_T_ADDR_FROM_ABANDONART, + REG_Z_ADDR_FROM_ABANDONART, + }; use crate::BASE_HEIGHT; use super::super::regtest::get_regtest_dir; use super::{data, ChildProcessHandler, RegtestManager}; use std::path::PathBuf; use tokio::time::sleep; + use zingolib::wallet::Pool; use zingolib::{lightclient::LightClient, wallet::WalletBase}; pub struct ScenarioBuilder { pub test_env: TestEnvironmentGenerator, @@ -289,15 +290,17 @@ pub mod scenarios { } fn configure_scenario( &mut self, - funded: Option, + mine_to_pool: Option, regtest_network: &zingoconfig::RegtestNetwork, ) { - if let Some(funding_seed) = funded { - self.test_env - .create_funded_zcash_conf(&funding_seed, regtest_network); - } else { - self.test_env.create_unfunded_zcash_conf(regtest_network); + let mine_to_address = match mine_to_pool { + Some(Pool::Orchard) => Some(REG_O_ADDR_FROM_ABANDONART), + Some(Pool::Sapling) => Some(REG_Z_ADDR_FROM_ABANDONART), + Some(Pool::Transparent) => Some(REG_T_ADDR_FROM_ABANDONART), + None => None, }; + self.test_env + .create_zcash_conf(mine_to_address, regtest_network); self.test_env.create_lightwalletd_conf(); } async fn launch_scenario(&mut self, clean: bool) { @@ -338,17 +341,14 @@ pub mod scenarios { .output() .expect("copy operation into fresh dir from known dir to succeed"); dbg!(&sb.test_env.regtest_manager.zcashd_config); - sb.configure_scenario( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), - regtest_network, - ); + sb.configure_scenario(Some(Pool::Sapling), regtest_network); sb.launch_scenario(false).await; sb } /// Writes the specified zcashd.conf and launches with it pub async fn build_configure_launch( - funded: Option, + mine_to_pool: Option, zingo_wallet_dir: Option, set_lightwalletd_port: Option, regtest_network: &zingoconfig::RegtestNetwork, @@ -358,7 +358,7 @@ pub mod scenarios { } else { ScenarioBuilder::build_scenario(None, set_lightwalletd_port) }; - sb.configure_scenario(funded, regtest_network); + sb.configure_scenario(mine_to_pool, regtest_network); sb.launch_scenario(true).await; sb } @@ -478,33 +478,24 @@ pub mod scenarios { lightwalletd_uri: server_uri, } } - pub(crate) fn create_unfunded_zcash_conf( + pub(crate) fn create_zcash_conf( &self, + mine_to_address: Option<&str>, regtest_network: &zingoconfig::RegtestNetwork, ) -> PathBuf { - //! Side effect only fn, writes to FS. - self.write_contents_and_return_path( - "zcash", - data::config_template_fillers::zcashd::basic( + let config = match mine_to_address { + Some(address) => data::config_template_fillers::zcashd::funded( + address, &self.zcashd_rpcservice_port, regtest_network, - "", ), - ) - } - pub(crate) fn create_funded_zcash_conf( - &self, - address_to_fund: &str, - regtest_network: &zingoconfig::RegtestNetwork, - ) -> PathBuf { - self.write_contents_and_return_path( - "zcash", - data::config_template_fillers::zcashd::funded( - address_to_fund, + None => data::config_template_fillers::zcashd::basic( &self.zcashd_rpcservice_port, regtest_network, + "", ), - ) + }; + self.write_contents_and_return_path("zcash", config) } pub(crate) fn create_lightwalletd_conf(&self) -> PathBuf { self.write_contents_and_return_path( @@ -550,7 +541,6 @@ pub mod scenarios { .await, ) } - pub async fn unfunded_client_default() -> (RegtestManager, ChildProcessHandler, LightClient) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); unfunded_client(regtest_network).await @@ -567,10 +557,11 @@ pub mod scenarios { /// of scenarios. As scenarios with even less requirements /// become interesting (e.g. without experimental features, or txindices) we'll create more setups. pub async fn faucet( + mine_to_pool: Pool, regtest_network: zingoconfig::RegtestNetwork, ) -> (RegtestManager, ChildProcessHandler, LightClient) { let mut sb = setup::ScenarioBuilder::build_configure_launch( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), + Some(mine_to_pool), None, None, ®test_network, @@ -584,13 +575,13 @@ pub mod scenarios { faucet, ) } - pub async fn faucet_default() -> (RegtestManager, ChildProcessHandler, LightClient) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); - faucet(regtest_network).await + faucet(Pool::Orchard, regtest_network).await } pub async fn faucet_recipient( + mine_to_pool: Pool, regtest_network: zingoconfig::RegtestNetwork, ) -> ( RegtestManager, @@ -599,7 +590,7 @@ pub mod scenarios { LightClient, ) { let mut sb = setup::ScenarioBuilder::build_configure_launch( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), + Some(mine_to_pool), None, None, ®test_network, @@ -624,7 +615,6 @@ pub mod scenarios { recipient, ) } - pub async fn faucet_recipient_default() -> ( RegtestManager, ChildProcessHandler, @@ -632,13 +622,14 @@ pub mod scenarios { LightClient, ) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); - faucet_recipient(regtest_network).await + faucet_recipient(Pool::Orchard, regtest_network).await } pub async fn faucet_funded_recipient( orchard_funds: Option, sapling_funds: Option, transparent_funds: Option, + mine_to_pool: Pool, regtest_network: zingoconfig::RegtestNetwork, ) -> ( RegtestManager, @@ -650,7 +641,7 @@ pub mod scenarios { Option, ) { let (regtest_manager, child_process_handler, faucet, recipient) = - faucet_recipient(regtest_network).await; + faucet_recipient(mine_to_pool, regtest_network).await; increase_height_and_wait_for_client(®test_manager, &faucet, 1) .await .unwrap(); @@ -710,7 +701,6 @@ pub mod scenarios { transparent_txid, ) } - pub async fn faucet_funded_recipient_default( orchard_funds: u64, ) -> ( @@ -729,56 +719,29 @@ pub mod scenarios { orchard_txid, _sapling_txid, _transparent_txid, - ) = faucet_funded_recipient(Some(orchard_funds), None, None, regtest_network).await; - ( - regtest_manager, - cph, - faucet, - recipient, - orchard_txid.unwrap(), - ) - } - - pub async fn faucet_recipient_transparent( - regtest_network: zingoconfig::RegtestNetwork, - ) -> ( - RegtestManager, - ChildProcessHandler, - LightClient, - LightClient, - ) { - let mut sb = setup::ScenarioBuilder::build_configure_launch( - Some(REG_T_ADDR_FROM_ABANDONART.to_string()), + ) = faucet_funded_recipient( + Some(orchard_funds), None, None, - ®test_network, + Pool::Orchard, + regtest_network, ) .await; - let faucet = sb.client_builder.build_faucet(false, regtest_network).await; - faucet.do_sync(false).await.unwrap(); - - let recipient = sb - .client_builder - .build_client( - HOSPITAL_MUSEUM_SEED.to_string(), - BASE_HEIGHT as u64, - false, - regtest_network, - ) - .await; ( - sb.regtest_manager, - sb.child_process_handler.unwrap(), + regtest_manager, + cph, faucet, recipient, + orchard_txid.unwrap(), ) } pub async fn custom_clients( + mine_to_pool: Pool, regtest_network: zingoconfig::RegtestNetwork, ) -> (RegtestManager, ChildProcessHandler, ClientBuilder) { let sb = setup::ScenarioBuilder::build_configure_launch( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), + Some(mine_to_pool), None, None, ®test_network, @@ -790,7 +753,6 @@ pub mod scenarios { sb.client_builder, ) } - pub async fn custom_clients_default() -> ( RegtestManager, ChildProcessHandler, @@ -798,7 +760,8 @@ pub mod scenarios { zingoconfig::RegtestNetwork, ) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); - let (regtest_manager, cph, client_builder) = custom_clients(regtest_network).await; + let (regtest_manager, cph, client_builder) = + custom_clients(Pool::Orchard, regtest_network).await; (regtest_manager, cph, client_builder, regtest_network) } @@ -820,7 +783,7 @@ pub mod scenarios { pub async fn funded_orchard_mobileclient(value: u64) -> (RegtestManager, ChildProcessHandler) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); let mut scenario_builder = setup::ScenarioBuilder::build_configure_launch( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), + Some(Pool::Sapling), None, Some(20_000), ®test_network, @@ -858,7 +821,7 @@ pub mod scenarios { ) -> (RegtestManager, ChildProcessHandler) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); let mut scenario_builder = setup::ScenarioBuilder::build_configure_launch( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), + Some(Pool::Sapling), None, Some(20_000), ®test_network, @@ -923,7 +886,7 @@ pub mod scenarios { ) -> (RegtestManager, ChildProcessHandler) { let regtest_network = zingoconfig::RegtestNetwork::all_upgrades_active(); let mut scenario_builder = setup::ScenarioBuilder::build_configure_launch( - Some(REG_Z_ADDR_FROM_ABANDONART.to_string()), + Some(Pool::Sapling), None, Some(20_000), ®test_network, diff --git a/zingocli/tests/integration_tests.rs b/zingocli/tests/integration_tests.rs index 828ae6c10..00a08b8fc 100644 --- a/zingocli/tests/integration_tests.rs +++ b/zingocli/tests/integration_tests.rs @@ -100,7 +100,7 @@ async fn multiple_outgoing_metadatas_work_right_on_restore() { async fn dont_write_unconfirmed() { let regtest_network = RegtestNetwork::all_upgrades_active(); let (regtest_manager, _cph, faucet, recipient) = - scenarios::faucet_recipient(regtest_network).await; + scenarios::faucet_recipient(Pool::Orchard, regtest_network).await; faucet .do_send(vec![( &get_base_address!(recipient, "unified"), @@ -146,7 +146,6 @@ async fn dont_write_unconfirmed() { .unwrap(); let recipient_balance = recipient.do_balance().await; - dbg!(&recipient_balance.unverified_orchard_balance); assert_eq!( recipient_balance.unverified_orchard_balance.unwrap(), 65_000 @@ -655,21 +654,11 @@ async fn actual_empty_zcashd_sapling_commitment_tree() { //dbg!(std::process::Command::new("grpcurl").args(["-plaintext", "127.0.0.1:9067"])); } -#[tokio::test] -async fn mine_sapling_to_self() { - let (regtest_manager, _cph, faucet) = scenarios::faucet_default().await; - check_client_balances!(faucet, o: 0u64 s: 1_875_000_000u64 t: 0u64); - zingo_testutils::increase_height_and_wait_for_client(®test_manager, &faucet, 1) - .await - .unwrap(); - check_client_balances!(faucet, o: 0u64 s: 2_500_000_000u64 t: 0u64); -} - #[tokio::test] async fn unspent_notes_are_not_saved() { let regtest_network = RegtestNetwork::all_upgrades_active(); let (regtest_manager, _cph, faucet, recipient) = - scenarios::faucet_recipient(regtest_network).await; + scenarios::faucet_recipient(Pool::Orchard, regtest_network).await; zingo_testutils::increase_height_and_wait_for_client(®test_manager, &faucet, 1) .await .unwrap(); @@ -739,7 +728,8 @@ async fn send_mined_sapling_to_orchard() { // debiting unverified_orchard_balance and crediting verified_orchard_balance. The debit amount is // consistent with all the notes in the relevant block changing state. // NOTE that the balance doesn't give insight into the distribution across notes. - let (regtest_manager, _cph, faucet) = scenarios::faucet_default().await; + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet) = scenarios::faucet(Pool::Sapling, regtest_network).await; let amount_to_send = 5_000; faucet .do_send(vec![( @@ -1043,7 +1033,7 @@ async fn send_orchard_back_and_forth() { let three_blocks_reward = block_rewards::CANOPY .checked_mul(BASE_HEIGHT as u64) .unwrap(); - check_client_balances!(faucet, o: 0 s: three_blocks_reward t: 0); + check_client_balances!(faucet, o: three_blocks_reward s: 0 t: 0); // post transfer to recipient, and verify faucet @@ -1055,12 +1045,11 @@ async fn send_orchard_back_and_forth() { .await .unwrap(); let orch_change = block_rewards::CANOPY - (faucet_to_recipient_amount + u64::from(MINIMUM_FEE)); - let reward_and_fee = three_blocks_reward + u64::from(MINIMUM_FEE); zingo_testutils::increase_height_and_wait_for_client(®test_manager, &recipient, 1) .await .unwrap(); faucet.do_sync(true).await.unwrap(); - check_client_balances!(recipient, o: faucet_to_recipient_amount s: 0 t: 0); + let faucet_orch = three_blocks_reward + orch_change + u64::from(MINIMUM_FEE); println!( "{}", @@ -1071,7 +1060,8 @@ async fn send_orchard_back_and_forth() { serde_json::to_string_pretty(&faucet.do_balance().await).unwrap() ); - check_client_balances!(faucet, o: orch_change s: reward_and_fee t: 0); + check_client_balances!(faucet, o: faucet_orch s: 0 t: 0); + check_client_balances!(recipient, o: faucet_to_recipient_amount s: 0 t: 0); // post half back to faucet, and verify recipient @@ -1087,13 +1077,13 @@ async fn send_orchard_back_and_forth() { .unwrap(); recipient.do_sync(true).await.unwrap(); + let faucet_final_orch = + faucet_orch + recipient_to_faucet_amount + block_rewards::CANOPY + u64::from(MINIMUM_FEE); let recipient_final_orch = faucet_to_recipient_amount - (u64::from(MINIMUM_FEE) + recipient_to_faucet_amount); - let faucet_final_orch = orch_change + recipient_to_faucet_amount; - let faucet_final_block = 4 * block_rewards::CANOPY + u64::from(MINIMUM_FEE) * 2; check_client_balances!( faucet, - o: faucet_final_orch s: faucet_final_block t: 0 + o: faucet_final_orch s: 0 t: 0 ); check_client_balances!(recipient, o: recipient_final_orch s: 0 t: 0); } @@ -1312,7 +1302,7 @@ async fn handling_of_nonregenerated_diversified_addresses_after_seed_restore() { //The first address in a wallet should always contain all three currently extant //receiver types. recipient_restored - .do_send(vec![(&get_base_address!(faucet, "unified"), 4_000, None)]) + .do_send(vec![(&get_base_address!(faucet, "sapling"), 4_000, None)]) .await .unwrap(); let sender_balance = faucet.do_balance().await; @@ -1323,8 +1313,8 @@ async fn handling_of_nonregenerated_diversified_addresses_after_seed_restore() { //Ensure that recipient_restored was still able to spend the note, despite not having the //diversified address associated with it assert_eq!( - faucet.do_balance().await.spendable_orchard_balance.unwrap(), - sender_balance.spendable_orchard_balance.unwrap() + 4_000 + faucet.do_balance().await.spendable_sapling_balance.unwrap(), + sender_balance.spendable_sapling_balance.unwrap() + 4_000 ); recipient_restored.do_seed_phrase().await.unwrap() }; @@ -1954,9 +1944,11 @@ async fn mempool_clearing_and_full_batch_syncs_correct_trees() { } } let value = 100_000; - let (regtest_manager, _cph, faucet, recipient, orig_transaction_id) = - scenarios::faucet_funded_recipient_default(value).await; - + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet, recipient, orig_transaction_id, _, _) = + scenarios::faucet_funded_recipient(Some(value), None, None, Pool::Sapling, regtest_network) + .await; + let orig_transaction_id = orig_transaction_id.unwrap(); assert_eq!( do_maybe_recent_txid(&recipient).await["last_txid"], orig_transaction_id @@ -2055,18 +2047,6 @@ async fn mempool_clearing_and_full_batch_syncs_correct_trees() { // Sync recipient recipient.do_sync(false).await.unwrap(); - dbg!( - &recipient - .wallet - .transaction_context - .transaction_metadata_set - .read() - .await - .witness_trees - .as_ref() - .unwrap() - .witness_tree_orchard - ); // 4b write down state before clearing the mempool let notes_before = recipient.do_list_notes(true).await; @@ -2757,7 +2737,8 @@ async fn by_address_finsight() { #[tokio::test] async fn load_old_wallet_at_reorged_height() { let regtest_network = RegtestNetwork::all_upgrades_active(); - let (ref regtest_manager, cph, ref faucet) = scenarios::faucet(regtest_network).await; + let (ref regtest_manager, cph, ref faucet) = + scenarios::faucet(Pool::Orchard, regtest_network).await; println!("Shutting down initial zcd/lwd unneeded processes"); drop(cph); @@ -3321,35 +3302,10 @@ async fn sync_all_epochs_from_sapling() { .unwrap(); } -// test fails to exit when syncing pre-sapling -// possible issue with dropping child process handler? -#[ignore] -#[tokio::test] -async fn sync_all_epochs() { - let regtest_network = RegtestNetwork::new(1, 3, 5, 7, 9, 11); - let (regtest_manager, _cph, lightclient) = scenarios::unfunded_client(regtest_network).await; - increase_height_and_wait_for_client(®test_manager, &lightclient, 12) - .await - .unwrap(); -} - -// test fails with error message: "66: tx unpaid action limit exceeded" -#[ignore] -#[tokio::test] -async fn mine_to_transparent_and_shield() { - let regtest_network = RegtestNetwork::all_upgrades_active(); - let (regtest_manager, _cph, faucet, _recipient) = - scenarios::faucet_recipient_transparent(regtest_network).await; - increase_height_and_wait_for_client(®test_manager, &faucet, 100) - .await - .unwrap(); - faucet.do_shield(&[Pool::Transparent], None).await.unwrap(); -} - #[tokio::test] async fn shield_heartwood_sapling_funds() { let regtest_network = RegtestNetwork::new(1, 1, 1, 1, 3, 5); - let (regtest_manager, _cph, faucet) = scenarios::faucet(regtest_network).await; + let (regtest_manager, _cph, faucet) = scenarios::faucet(Pool::Sapling, regtest_network).await; increase_height_and_wait_for_client(®test_manager, &faucet, 3) .await .unwrap(); @@ -3365,7 +3321,7 @@ async fn shield_heartwood_sapling_funds() { async fn send_heartwood_sapling_funds() { let regtest_network = RegtestNetwork::new(1, 1, 1, 1, 3, 5); let (regtest_manager, _cph, faucet, recipient) = - scenarios::faucet_recipient(regtest_network).await; + scenarios::faucet_recipient(Pool::Sapling, regtest_network).await; increase_height_and_wait_for_client(®test_manager, &faucet, 3) .await .unwrap(); @@ -3400,8 +3356,68 @@ async fn send_funds_to_all_pools() { Some(100_000), Some(100_000), Some(100_000), + Pool::Orchard, regtest_network, ) .await; check_client_balances!(recipient, o: 100_000 s: 100_000 t: 100_000); } + +#[tokio::test] +async fn mine_to_orchard() { + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet) = scenarios::faucet(Pool::Orchard, regtest_network).await; + check_client_balances!(faucet, o: 1_875_000_000 s: 0 t: 0); + increase_height_and_wait_for_client(®test_manager, &faucet, 1) + .await + .unwrap(); + check_client_balances!(faucet, o: 2_500_000_000 s: 0 t: 0); +} + +#[tokio::test] +async fn mine_to_sapling() { + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet) = scenarios::faucet(Pool::Sapling, regtest_network).await; + check_client_balances!(faucet, o: 0 s: 1_875_000_000 t: 0); + increase_height_and_wait_for_client(®test_manager, &faucet, 1) + .await + .unwrap(); + check_client_balances!(faucet, o: 0 s: 2_500_000_000 t: 0); +} + +#[tokio::test] +async fn mine_to_transparent() { + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet, _recipient) = + scenarios::faucet_recipient(Pool::Transparent, regtest_network).await; + check_client_balances!(faucet, o: 0 s: 0 t: 1_875_000_000); + increase_height_and_wait_for_client(®test_manager, &faucet, 1) + .await + .unwrap(); + check_client_balances!(faucet, o: 0 s: 0 t: 2_500_000_000); +} + +// test fails to exit when syncing pre-sapling +// possible issue with dropping child process handler? +#[ignore] +#[tokio::test] +async fn sync_all_epochs() { + let regtest_network = RegtestNetwork::new(1, 3, 5, 7, 9, 11); + let (regtest_manager, _cph, lightclient) = scenarios::unfunded_client(regtest_network).await; + increase_height_and_wait_for_client(®test_manager, &lightclient, 12) + .await + .unwrap(); +} + +// test fails with error message: "66: tx unpaid action limit exceeded" +#[ignore] +#[tokio::test] +async fn mine_to_transparent_and_shield() { + let regtest_network = RegtestNetwork::all_upgrades_active(); + let (regtest_manager, _cph, faucet, _recipient) = + scenarios::faucet_recipient(Pool::Transparent, regtest_network).await; + increase_height_and_wait_for_client(®test_manager, &faucet, 100) + .await + .unwrap(); + faucet.do_shield(&[Pool::Transparent], None).await.unwrap(); +} diff --git a/zingolib/src/wallet.rs b/zingolib/src/wallet.rs index 4ba45a4b2..10bec7c58 100644 --- a/zingolib/src/wallet.rs +++ b/zingolib/src/wallet.rs @@ -86,16 +86,16 @@ pub struct SendProgress { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Pool { - Sapling, Orchard, + Sapling, Transparent, } impl From for JsonValue { fn from(value: Pool) -> Self { match value { - Pool::Sapling => JsonValue::String(String::from("Sapling")), Pool::Orchard => JsonValue::String(String::from("Orchard")), + Pool::Sapling => JsonValue::String(String::from("Sapling")), Pool::Transparent => JsonValue::String(String::from("Transparent")), } } From 2c6d52980ae88b6b275978dc1399759f44ef2a9a Mon Sep 17 00:00:00 2001 From: Oscar Pepper Date: Tue, 17 Oct 2023 16:36:48 +0100 Subject: [PATCH 2/2] fix unspent note test --- zingocli/tests/integration_tests.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/zingocli/tests/integration_tests.rs b/zingocli/tests/integration_tests.rs index 00a08b8fc..ba2722184 100644 --- a/zingocli/tests/integration_tests.rs +++ b/zingocli/tests/integration_tests.rs @@ -146,6 +146,7 @@ async fn dont_write_unconfirmed() { .unwrap(); let recipient_balance = recipient.do_balance().await; + dbg!(&recipient_balance.unverified_orchard_balance); assert_eq!( recipient_balance.unverified_orchard_balance.unwrap(), 65_000 @@ -658,12 +659,12 @@ async fn actual_empty_zcashd_sapling_commitment_tree() { async fn unspent_notes_are_not_saved() { let regtest_network = RegtestNetwork::all_upgrades_active(); let (regtest_manager, _cph, faucet, recipient) = - scenarios::faucet_recipient(Pool::Orchard, regtest_network).await; + scenarios::faucet_recipient(Pool::Sapling, regtest_network).await; zingo_testutils::increase_height_and_wait_for_client(®test_manager, &faucet, 1) .await .unwrap(); - check_client_balances!(faucet, o: 0u64 s: 2_500_000_000u64 t: 0u64); + check_client_balances!(faucet, o: 0 s: 2_500_000_000u64 t: 0u64); faucet .do_send(vec![( get_base_address!(recipient, "unified").as_str(), @@ -2047,6 +2048,18 @@ async fn mempool_clearing_and_full_batch_syncs_correct_trees() { // Sync recipient recipient.do_sync(false).await.unwrap(); + dbg!( + &recipient + .wallet + .transaction_context + .transaction_metadata_set + .read() + .await + .witness_trees + .as_ref() + .unwrap() + .witness_tree_orchard + ); // 4b write down state before clearing the mempool let notes_before = recipient.do_list_notes(true).await;