Skip to content
Open
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
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[workspace]
members = ["accumulator", "hintfile", "node"]
members = ["accumulator", "node"]
default-members = ["accumulator"]
resolver = "2"

[workspace.dependencies]
bitcoin = { git = "https://github.com/rust-bitcoin/rust-bitcoin", default-features = false, rev = "16cc257c3695dea0e7301a5fa9cab44b8ed60598" }
hintsfile = { git = "https://github.com/rustaceanrob/hintsfile.git" }
# hintsfile = { path = "../hintsfile/" }
kernel = { package = "bitcoinkernel", git = "https://github.com/alexanderwiederin/rust-bitcoinkernel.git", rev = "353533221e3ba91d672418eab1ae7b83a61214f9" }
p2p = { package = "bitcoin-p2p", git = "https://github.com/2140-dev/bitcoin-p2p.git", rev = "a8b3af8dfc32a06eadb867b07afd537ebf347104" }
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
This repository is a collection of crates related to a SwiftSync node implementation. Some crates will be SwiftSync-specific, while others may have broader use cases.

- `accumulator`: A hash-based SwiftSync accumulator used to add and subtrack elements from a set.
- `hintfile`: Read a hints file from a server.
- `node`: Perform fast IBD using a SwiftSync hints file.
6 changes: 0 additions & 6 deletions hintfile/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions hintfile/README.md

This file was deleted.

152 changes: 0 additions & 152 deletions hintfile/src/lib.rs

This file was deleted.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build = "build.rs"
accumulator = { path = "../accumulator/" }
bitcoin = { workspace = true }
kernel = { workspace = true }
hintfile = { path = "../hintfile/" }
hintsfile = { workspace = true }
p2p = { workspace = true }

configure_me = "0.4.0"
Expand Down
6 changes: 3 additions & 3 deletions node/src/bin/ibd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
};

use bitcoin::Network;
use hintfile::Hints;
use hintsfile::Hintsfile;
use kernel::{ChainstateManager, ChainstateManagerOptions, ContextBuilder};

use node::{
Expand Down Expand Up @@ -41,8 +41,8 @@ fn main() {
tracing::subscriber::set_global_default(subscriber).unwrap();
let hintfile_start_time = Instant::now();
tracing::info!("Reading in {hint_path}");
let hintfile = File::open(hint_path).expect("invalid hintfile path");
let hints = Hints::from_file(hintfile);
let mut hintfile = File::open(hint_path).expect("invalid hintfile path");
let hints = Hintsfile::from_reader(&mut hintfile);
let stop_height = hints.stop_height();
elapsed_time(hintfile_start_time);
tracing::info!("Syncing to height {}", hints.stop_height());
Expand Down
14 changes: 9 additions & 5 deletions node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use bitcoin::{
transaction::TransactionExt,
BlockHash, Network, OutPoint,
};
use hintfile::Hints;
use hintsfile::Hintsfile;
use kernel::{ChainType, ChainstateManager};
use p2p::{
dns::DnsQueryExt,
Expand Down Expand Up @@ -177,7 +177,7 @@ pub fn get_blocks_for_range(
network: Network,
block_dir: Option<PathBuf>,
chain: Arc<ChainstateManager>,
hints: Arc<Mutex<Hints>>,
hints: Arc<Mutex<Hintsfile>>,
peers: Arc<Mutex<Vec<SocketAddr>>>,
updater: Sender<AccumulatorUpdate>,
hashes: Arc<Mutex<Vec<Vec<BlockHash>>>>,
Expand Down Expand Up @@ -234,9 +234,13 @@ pub fn get_blocks_for_range(
.block_index_by_hash(kernal_hash)
.expect("header is in best chain.");
let block_height = block_index.height().unsigned_abs();
let unspent_indexes: HashSet<u64> = {
let mut hint_ref = hints.lock().unwrap();
hint_ref.get_indexes(block_height).into_iter().collect()
let unspent_indexes: HashSet<u16> = {
let hint_ref = hints.lock().unwrap();
hint_ref
.indices_at_height(block_height)
.expect("hints should exist")
.into_iter()
.collect()
};
if let Some(block_dir) = block_dir.as_ref() {
let file_path = block_dir.join(format!("{hash}.block"));
Expand Down