mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
snapshot
This commit is contained in:
34
Cargo.lock
generated
34
Cargo.lock
generated
@@ -1376,9 +1376,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.2.46"
|
||||
version = "1.2.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36"
|
||||
checksum = "cd405d82c84ff7f35739f175f67d8b9fb7687a0e84ccdc78bd3568839827cf07"
|
||||
dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
@@ -2419,7 +2419,7 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c7ed2f2edad8a14c8186b847909a41fbb9c3eafa44f88bd891114ed5019da09"
|
||||
dependencies = [
|
||||
"hashbrown 0.16.0",
|
||||
"hashbrown 0.16.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2439,9 +2439,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.16.0"
|
||||
version = "0.16.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
||||
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"equivalent",
|
||||
@@ -2706,12 +2706,12 @@ checksum = "964de6e86d545b246d84badc0fef527924ace5134f30641c203ef52ba83f58d5"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "2.12.0"
|
||||
version = "2.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
|
||||
checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
|
||||
dependencies = [
|
||||
"equivalent",
|
||||
"hashbrown 0.16.0",
|
||||
"hashbrown 0.16.1",
|
||||
"serde",
|
||||
"serde_core",
|
||||
]
|
||||
@@ -2859,9 +2859,9 @@ checksum = "a3c2a6c0b4b5637c41719973ef40c6a1cf564f9db6958350de6193fbee9c23f5"
|
||||
|
||||
[[package]]
|
||||
name = "json-strip-comments"
|
||||
version = "3.0.1"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4135b29c84322dbc3327272084360785665452213a576a991b3ac2f63148e82"
|
||||
checksum = "25376d12b2f6ae53f986f86e2a808a56af03d72284ae24fc35a2e290d09ee3c3"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -3364,7 +3364,7 @@ checksum = "674f1447d47e26970ff13d8da8140ffb0d7fde347ab9af3e5c00e67943d4bc9b"
|
||||
dependencies = [
|
||||
"allocator-api2",
|
||||
"bumpalo",
|
||||
"hashbrown 0.16.0",
|
||||
"hashbrown 0.16.1",
|
||||
"oxc_data_structures",
|
||||
"oxc_estree",
|
||||
"rustc-hash",
|
||||
@@ -4115,7 +4115,7 @@ checksum = "7ada44a88ef953a3294f6eb55d2007ba44646015e18613d2f213016379203ef3"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"equivalent",
|
||||
"hashbrown 0.16.0",
|
||||
"hashbrown 0.16.1",
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
@@ -4336,7 +4336,7 @@ version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2057b2325e68a893284d1538021ab90279adac1139957ca2a74426c6f118fb48"
|
||||
dependencies = [
|
||||
"hashbrown 0.16.0",
|
||||
"hashbrown 0.16.1",
|
||||
"memchr",
|
||||
]
|
||||
|
||||
@@ -5940,18 +5940,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy"
|
||||
version = "0.8.27"
|
||||
version = "0.8.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
|
||||
checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90"
|
||||
dependencies = [
|
||||
"zerocopy-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zerocopy-derive"
|
||||
version = "0.8.27"
|
||||
version = "0.8.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
|
||||
checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -81,7 +81,7 @@ serde_json = { version = "1.0.145", features = ["float_roundtrip"] }
|
||||
tokio = { version = "1.48.0", features = ["rt-multi-thread"] }
|
||||
vecdb = { path = "../anydb/crates/vecdb", features = ["derive", "serde_json"] }
|
||||
# vecdb = { version = "0.3.20", features = ["derive"] }
|
||||
zerocopy = { version = "0.8.27", features = ["derive"] }
|
||||
zerocopy = { version = "0.8.28", features = ["derive"] }
|
||||
|
||||
[workspace.metadata.release]
|
||||
shared-version = true
|
||||
|
||||
@@ -17,7 +17,7 @@ use vecdb::Exit;
|
||||
pub fn main() -> Result<()> {
|
||||
// Can't increase main thread's stack size, thus we need to use another thread
|
||||
thread::Builder::new()
|
||||
.stack_size(512 * 1024 * 1024)
|
||||
.stack_size(1024 * 1024 * 1024)
|
||||
.spawn(run)?
|
||||
.join()
|
||||
.unwrap()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
use std::{path::Path, thread};
|
||||
use std::{path::Path, thread, time::Instant};
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_fetcher::Fetcher;
|
||||
@@ -151,61 +151,79 @@ impl Computer {
|
||||
&mut self,
|
||||
indexer: &Indexer,
|
||||
starting_indexes: brk_indexer::Indexes,
|
||||
parser: &Reader,
|
||||
reader: &Reader,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
info!("Computing indexes...");
|
||||
let i = Instant::now();
|
||||
let mut starting_indexes = self.indexes.compute(indexer, starting_indexes, exit)?;
|
||||
info!("Computed indexes in {:?}", i.elapsed());
|
||||
|
||||
if let Some(fetched) = self.fetched.as_mut() {
|
||||
info!("Computing fetched...");
|
||||
let i = Instant::now();
|
||||
fetched.compute(indexer, &self.indexes, &starting_indexes, exit)?;
|
||||
info!("Computed fetched in {:?}", i.elapsed());
|
||||
|
||||
info!("Computing prices...");
|
||||
let i = Instant::now();
|
||||
self.price.as_mut().unwrap().compute(
|
||||
&self.indexes,
|
||||
&starting_indexes,
|
||||
fetched,
|
||||
exit,
|
||||
)?;
|
||||
info!("Computed prices in {:?}", i.elapsed());
|
||||
}
|
||||
|
||||
info!("Computing BLKs metadata...");
|
||||
self.blks
|
||||
.compute(indexer, &starting_indexes, parser, exit)?;
|
||||
std::thread::scope(|scope| -> Result<()> {
|
||||
let blks = scope.spawn(|| -> Result<()> {
|
||||
info!("Computing BLKs metadata...");
|
||||
let i = Instant::now();
|
||||
self.blks
|
||||
.compute(indexer, &starting_indexes, reader, exit)?;
|
||||
info!("Computed blk in {:?}", i.elapsed());
|
||||
Ok(())
|
||||
});
|
||||
|
||||
// std::thread::scope(|scope| -> Result<()> {
|
||||
// let constants = scope.spawn(|| -> Result<()> {
|
||||
info!("Computing constants...");
|
||||
self.constants
|
||||
.compute(&self.indexes, &starting_indexes, exit)?;
|
||||
// Ok(())
|
||||
// });
|
||||
let constants = scope.spawn(|| -> Result<()> {
|
||||
info!("Computing constants...");
|
||||
let i = Instant::now();
|
||||
self.constants
|
||||
.compute(&self.indexes, &starting_indexes, exit)?;
|
||||
info!("Computed constants in {:?}", i.elapsed());
|
||||
Ok(())
|
||||
});
|
||||
|
||||
// let chain = scope.spawn(|| -> Result<()> {
|
||||
info!("Computing chain...");
|
||||
self.chain.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
&starting_indexes,
|
||||
self.price.as_ref(),
|
||||
exit,
|
||||
)?;
|
||||
// Ok(())
|
||||
// });
|
||||
let chain = scope.spawn(|| -> Result<()> {
|
||||
info!("Computing chain...");
|
||||
let i = Instant::now();
|
||||
self.chain.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
&starting_indexes,
|
||||
self.price.as_ref(),
|
||||
exit,
|
||||
)?;
|
||||
info!("Computed chain in {:?}", i.elapsed());
|
||||
Ok(())
|
||||
});
|
||||
|
||||
if let Some(price) = self.price.as_ref() {
|
||||
info!("Computing market...");
|
||||
self.market.compute(price, &starting_indexes, exit)?;
|
||||
}
|
||||
if let Some(price) = self.price.as_ref() {
|
||||
info!("Computing market...");
|
||||
let i = Instant::now();
|
||||
self.market.compute(price, &starting_indexes, exit)?;
|
||||
info!("Computed market in {:?}", i.elapsed());
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
|
||||
// constants.join().unwrap()?;
|
||||
// chain.join().unwrap()?;
|
||||
// Ok(())
|
||||
// })?;
|
||||
blks.join().unwrap()?;
|
||||
constants.join().unwrap()?;
|
||||
chain.join().unwrap()?;
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
info!("Computing pools...");
|
||||
let i = Instant::now();
|
||||
self.pools.compute(
|
||||
indexer,
|
||||
&self.indexes,
|
||||
@@ -214,6 +232,7 @@ impl Computer {
|
||||
self.price.as_ref(),
|
||||
exit,
|
||||
)?;
|
||||
info!("Computed pools in {:?}", i.elapsed());
|
||||
|
||||
info!("Computing stateful...");
|
||||
self.stateful.compute(
|
||||
|
||||
@@ -534,6 +534,7 @@ impl Vecs {
|
||||
let height_to_first_p2wpkhaddressindex = &indexer.vecs.height_to_first_p2wpkhaddressindex;
|
||||
let height_to_first_p2wshaddressindex = &indexer.vecs.height_to_first_p2wshaddressindex;
|
||||
let height_to_first_txindex = &indexer.vecs.height_to_first_txindex;
|
||||
let height_to_txindex_count = chain.indexes_to_tx_count.height.as_ref().unwrap();
|
||||
let height_to_first_txinindex = &indexer.vecs.height_to_first_txinindex;
|
||||
let height_to_first_txoutindex = &indexer.vecs.height_to_first_txoutindex;
|
||||
let height_to_input_count = chain.indexes_to_input_count.height.unwrap_sum();
|
||||
@@ -578,6 +579,7 @@ impl Vecs {
|
||||
+ height_to_first_p2wpkhaddressindex.version()
|
||||
+ height_to_first_p2wshaddressindex.version()
|
||||
+ height_to_first_txindex.version()
|
||||
+ height_to_txindex_count.version()
|
||||
+ height_to_first_txinindex.version()
|
||||
+ height_to_first_txoutindex.version()
|
||||
+ height_to_input_count.version()
|
||||
@@ -778,6 +780,7 @@ impl Vecs {
|
||||
let mut height_to_first_p2wshaddressindex_iter =
|
||||
height_to_first_p2wshaddressindex.into_iter();
|
||||
let mut height_to_first_txindex_iter = height_to_first_txindex.into_iter();
|
||||
let mut height_to_txindex_count_iter = height_to_txindex_count.into_iter();
|
||||
let mut height_to_first_txinindex_iter = height_to_first_txinindex.into_iter();
|
||||
let mut height_to_first_txoutindex_iter = height_to_first_txoutindex.into_iter();
|
||||
let mut height_to_input_count_iter = height_to_input_count.into_iter();
|
||||
|
||||
@@ -33,14 +33,20 @@ impl From<String> for Address {
|
||||
impl TryFrom<&ScriptBuf> for Address {
|
||||
type Error = Error;
|
||||
fn try_from(script: &ScriptBuf) -> Result<Self, Self::Error> {
|
||||
Self::try_from(&AddressBytes::try_from(script)?)
|
||||
Self::try_from((script, OutputType::from(script)))
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<(&ScriptBuf, OutputType)> for Address {
|
||||
type Error = Error;
|
||||
fn try_from(tuple: (&ScriptBuf, OutputType)) -> Result<Self, Self::Error> {
|
||||
Self::try_from(&AddressBytes::try_from(tuple)?)
|
||||
fn try_from((script, outputtype): (&ScriptBuf, OutputType)) -> Result<Self, Self::Error> {
|
||||
if outputtype.is_address() {
|
||||
Ok(Self {
|
||||
address: script.to_hex_string(),
|
||||
})
|
||||
} else {
|
||||
Err(Error::InvalidAddress)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user