Skip to content

Commit aad37b9

Browse files
committed
feat: add UTXO indexer with CLI commands and serialization logic
1 parent f2c35ce commit aad37b9

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

utxo_indexer/Cargo.toml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
[package]
2-
name = "utxo_indexer"
3-
version = "0.1.0"
4-
edition = "2024"
5-
6-
[[bin]]
7-
name = "utxo_indexer"
8-
path = "src/main.rs"
9-
10-
[dependencies]
11-
anyhow = "1.0.100"
12-
bincode = "2.0.1"
13-
bitcoin = "0.32.7"
14-
byteorder = "1.5.0"
15-
clap = { version = "4.5.51", features = ["derive"] }
16-
hex = "0.4.3"
17-
rocksdb = "0.24.0"
1+
[workspace]
2+
resolver = "3"
3+
members = ["indexer"]

utxo_indexer/indexer/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "indexer"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[[bin]]
7+
name = "indexer"
8+
path = "src/main.rs"
9+
10+
[dependencies]
11+
anyhow = "1.0.100"
12+
bincode = "2.0.1"
13+
bitcoin = "0.32.7"
14+
byteorder = "1.5.0"
15+
clap = { version = "4.5.51", features = ["derive"] }
16+
hex = "0.4.3"
17+
rocksdb = "0.24.0"
File renamed without changes.

utxo_indexer/src/main.rs renamed to utxo_indexer/indexer/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use rocksdb::{DB, IteratorMode, Options};
1010
use std::{
1111
fs::File,
1212
io::{BufReader, BufWriter},
13-
path::Path,
1413
};
1514

1615
use bitcoin::hashes::sha256;
@@ -106,6 +105,8 @@ fn run_build_merkle_root(utxo_index_path: &str) -> Result<()> {
106105

107106
let utxos = load_utxos(utxo_index_path)?;
108107

108+
println!("Calculating Merkle root for {} UTXOs", utxos.len());
109+
109110
let mut merkle_tree_leaf_hashes: Vec<sha256::Hash> = Vec::with_capacity(utxos.len());
110111
for utxo in utxos {
111112
let leaf_hash = sha256::Hash::hash(&utxo);

0 commit comments

Comments
 (0)