Skip to content

Commit d3af121

Browse files
committed
feat: add utilities for testing persistence
Added the following functions to test if persistence of `bdk_chain` is happening correctly. - `persist_txgraph_changeset` - `persist_indexer_changeset` - `persist_local_chain_changeset` - `persist_last_seen`, `persist_last_evicted`, `persist_first_seen` - `persist_txouts` - `persist_txs` - `persist_anchors` - `persist_last_revealed` - `persist_spk_cache` Even though the first three tests cover every part of the `ChangeSet`s , the other tests are retained so as to help in unit testing.
1 parent 0f89edb commit d3af121

File tree

4 files changed

+955
-3
lines changed

4 files changed

+955
-3
lines changed

crates/testenv/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ workspace = true
1919
bdk_chain = { path = "../chain", version = "0.23.1", default-features = false }
2020
electrsd = { version = "0.36.1", features = [ "legacy" ], default-features = false }
2121
bitcoin = { version = "0.32.0", default-features = false }
22+
anyhow = "1.0.102"
23+
tempfile = {version = "3.27.0", default-features = false}
2224

2325
[dev-dependencies]
2426
bdk_testenv = { path = "." }
2527

2628
[features]
27-
default = ["std", "download"]
29+
default = ["std", "download", "miniscript"]
2830
download = ["electrsd/corepc-node_28_2", "electrsd/esplora_a33e97e1"]
2931
std = ["bdk_chain/std", "bitcoin/rand-std"]
3032
serde = ["bdk_chain/serde"]
31-
33+
miniscript = ["bdk_chain/miniscript"]
3234
[package.metadata.docs.rs]
3335
no-default-features = true

crates/testenv/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
22

3+
#[cfg(all(feature = "std", feature = "miniscript"))]
4+
pub mod persist_test_utils;
35
pub mod utils;
46

57
use anyhow::Context;

0 commit comments

Comments
 (0)