#[tokio::test]
pub async fn test_finalize_chain_update() -> anyhow::Result<()> {
struct TestCase<'a> {
+ #[allow(dead_code)]
name: &'a str,
/// Initial blockchain height to start the env with.
initial_env_height: u32,
},
];
- for (i, t) in test_cases.into_iter().enumerate() {
- println!("[{}] running test case: {}", i, t.name);
-
+ for t in test_cases.into_iter() {
let env = TestEnv::new()?;
let base_url = format!("http://{}", &env.electrsd.esplora_url.clone().unwrap());
let client = Builder::new(base_url.as_str()).build_async()?;
chain.apply_update(update)?;
chain
};
- println!("local chain height: {}", local_chain.tip().height());
// extend env chain
if let Some(to_mine) = t
// apply update
let mut updated_local_chain = local_chain.clone();
updated_local_chain.apply_update(update)?;
- println!(
- "updated local chain height: {}",
- updated_local_chain.tip().height()
- );
assert!(
{
#[test]
pub fn test_finalize_chain_update() -> anyhow::Result<()> {
struct TestCase<'a> {
+ #[allow(dead_code)]
name: &'a str,
/// Initial blockchain height to start the env with.
initial_env_height: u32,
},
];
- for (i, t) in test_cases.into_iter().enumerate() {
- println!("[{}] running test case: {}", i, t.name);
-
+ for t in test_cases.into_iter() {
let env = TestEnv::new()?;
let base_url = format!("http://{}", &env.electrsd.esplora_url.clone().unwrap());
let client = Builder::new(base_url.as_str()).build_blocking();
chain.apply_update(update)?;
chain
};
- println!("local chain height: {}", local_chain.tip().height());
// extend env chain
if let Some(to_mine) = t
// apply update
let mut updated_local_chain = local_chain.clone();
updated_local_chain.apply_update(update)?;
- println!(
- "updated local chain height: {}",
- updated_local_chain.tip().height()
- );
assert!(
{
];
for (i, t) in test_cases.into_iter().enumerate() {
- println!("Case {}: {}", i, t.name);
let mut chain = t.chain;
let mock_anchors = t
for short_write_len in 1..last_changeset_bytes.len() - 1 {
let file_path = temp_dir.path().join(format!("{}.dat", short_write_len));
- println!("Test file: {:?}", file_path);
// simulate creating a file, writing data where the last write is incomplete
{
for read_count in 0..changesets.len() {
let file_path = temp_dir.path().join(format!("{}.dat", read_count));
- println!("Test file: {:?}", file_path);
// First, we create the file with all the changesets!
let mut db = Store::<TestChangeSet>::create_new(&TEST_MAGIC_BYTES, &file_path).unwrap();
];
for (i, t) in test_cases.into_iter().enumerate() {
- println!("Case {}: {}", i, t.name);
let (required, optional) =
filter_duplicates(to_utxo_vec(t.required), to_utxo_vec(t.optional));
assert_eq!(