diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 009283f..ec59477 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -36,5 +36,8 @@ jobs: - uses: actions/checkout@v4 - uses: extractions/setup-just@v3 - uses: actions-rust-lang/setup-rust-toolchain@v1 - - run: just test + - name: "Install Bitcoin dependencies" + run: sudo apt-get install build-essential cmake pkgconf python3 libevent-dev libboost-dev + - name: "Run test suite" + run: just test diff --git a/Cargo.toml b/Cargo.toml index 7de75f3..dd30c53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [workspace] members = ["accumulator", "hintfile", "network"] -default-members = ["accumulator", "hintfile", "network"] +default-members = ["accumulator", "network"] resolver = "2" [workspace.dependencies] diff --git a/accumulator/src/lib.rs b/accumulator/src/lib.rs index 19122da..d43eb92 100644 --- a/accumulator/src/lib.rs +++ b/accumulator/src/lib.rs @@ -1,6 +1,6 @@ use bitcoin::{ - OutPoint, hashes::{sha256t, sha256t_tag}, + OutPoint, }; sha256t_tag! { @@ -115,8 +115,8 @@ impl Default for Accumulator { #[cfg(test)] mod tests { use bitcoin::{ + secp256k1::rand::{thread_rng, RngCore}, Txid, - secp256k1::rand::{RngCore, thread_rng}, }; use super::*; @@ -167,13 +167,8 @@ mod tests { #[test] fn test_accumulator_is_zero() { let mut acc = Accumulator::default(); - let [ - outpoint_one, - outpoint_two, - outpoint_three, - outpoint_four, - outpoint_five, - ] = make_five_outpoint(); + let [outpoint_one, outpoint_two, outpoint_three, outpoint_four, outpoint_five] = + make_five_outpoint(); // Add the members acc.add(outpoint_one); acc.add(outpoint_two); @@ -192,13 +187,8 @@ mod tests { #[test] fn test_same_state() { - let [ - outpoint_one, - outpoint_two, - outpoint_three, - outpoint_four, - outpoint_five, - ] = make_five_outpoint(); + let [outpoint_one, outpoint_two, outpoint_three, outpoint_four, outpoint_five] = + make_five_outpoint(); let mut acc_ref = Accumulator::default(); acc_ref.add(outpoint_two); acc_ref.add(outpoint_four); @@ -217,13 +207,8 @@ mod tests { #[test] fn test_prehashing() { - let [ - outpoint_one, - outpoint_two, - outpoint_three, - outpoint_four, - outpoint_five, - ] = make_five_outpoint(); + let [outpoint_one, outpoint_two, outpoint_three, outpoint_four, outpoint_five] = + make_five_outpoint(); let hash_one = hash_outpoint(outpoint_one); let hash_two = hash_outpoint(outpoint_two); let hash_three = hash_outpoint(outpoint_three); diff --git a/hintfile/Cargo.toml b/hintfile/Cargo.toml index 5a45232..0158f50 100644 --- a/hintfile/Cargo.toml +++ b/hintfile/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] bitcoin = { workspace = true } -kernel = { package = "bitcoinkernel", git = "https://github.com/alexanderwiederin/rust-bitcoinkernel.git" } +kernel = { package = "bitcoinkernel", git = "https://github.com/alexanderwiederin/rust-bitcoinkernel.git", rev = "31a53ebc81cf3648de2adea3ef7ee62b7a993221" } [[bin]] name = "construct" diff --git a/hintfile/src/bin/construct.rs b/hintfile/src/bin/construct.rs index bf32faa..ab02e5d 100644 --- a/hintfile/src/bin/construct.rs +++ b/hintfile/src/bin/construct.rs @@ -18,13 +18,13 @@ fn main() { .build() .unwrap(); let options = ChainstateManagerOptions::new(&ctx, &data_dir, &blocks_dir).unwrap(); - let context = Arc::new(ctx); - let chainman = ChainstateManager::new(options, context).unwrap(); + let _context = Arc::new(ctx); + let chainman = ChainstateManager::new(options).unwrap(); println!("Chain state initialized"); - let genesis = chainman.get_block_index_genesis(); - let tip = chainman.get_block_index_tip().block_hash().hash; + let genesis = chainman.block_index_genesis(); + let tip = chainman.block_index_tip().block_hash().hash; file.write_all(&tip).unwrap(); - let mut current = chainman.get_next_block_index(genesis).unwrap(); + let mut current = chainman.next_block_index(genesis).unwrap(); loop { let block = chainman.read_block_data(¤t).unwrap(); let bytes: Vec = block.into(); @@ -52,7 +52,7 @@ fn main() { for offset in block_offsets { write_compact_size(offset, &mut file).expect("unexpected EOF"); } - match chainman.get_next_block_index(current) { + match chainman.next_block_index(current) { Ok(next) => current = next, Err(KernelError::OutOfBounds) => break, Err(e) => panic!("{e}"),