Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = ["accumulator", "hintfile", "network"]
default-members = ["accumulator", "hintfile", "network"]
default-members = ["accumulator", "network"]
resolver = "2"

[workspace.dependencies]
Expand Down
31 changes: 8 additions & 23 deletions accumulator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use bitcoin::{
OutPoint,
hashes::{sha256t, sha256t_tag},
OutPoint,
};

sha256t_tag! {
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion hintfile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
12 changes: 6 additions & 6 deletions hintfile/src/bin/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&current).unwrap();
let bytes: Vec<u8> = block.into();
Expand Down Expand Up @@ -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}"),
Expand Down