global: snapshot

This commit is contained in:
nym21
2026-03-04 17:10:15 +01:00
parent 891f0dad9e
commit 9e23de4ba1
313 changed files with 9087 additions and 4918 deletions

View File

@@ -20,7 +20,11 @@ impl Query {
return Err(Error::OutOfRange("Block height out of range".into()));
}
let position = computer.positions.block_position.collect_one(height).unwrap();
let position = computer
.positions
.block_position
.collect_one(height)
.unwrap();
let size = indexer.vecs.blocks.total_size.collect_one(height).unwrap();
reader.read_raw_bytes(position, *size as usize)

View File

@@ -13,14 +13,7 @@ impl Query {
fn block_status_by_height(&self, height: Height) -> Result<BlockStatus> {
let indexer = self.indexer();
let max_height = Height::from(
indexer
.vecs
.blocks
.blockhash
.len()
.saturating_sub(1),
);
let max_height = Height::from(indexer.vecs.blocks.blockhash.len().saturating_sub(1));
if height > max_height {
return Ok(BlockStatus::not_in_best_chain());

View File

@@ -57,7 +57,12 @@ impl Query {
}
let height = Height::from(best_height);
let blockhash = indexer.vecs.blocks.blockhash.reader().get(usize::from(height));
let blockhash = indexer
.vecs
.blocks
.blockhash
.reader()
.get(usize::from(height));
// Convert timestamp to ISO 8601 format
let ts_secs: i64 = (*best_ts).into();

View File

@@ -31,7 +31,12 @@ impl Query {
return Err(Error::OutOfRange("Block height out of range".into()));
}
let first_txindex = indexer.vecs.transactions.first_txindex.collect_one(height).unwrap();
let first_txindex = indexer
.vecs
.transactions
.first_txindex
.collect_one(height)
.unwrap();
let next_first_txindex = indexer
.vecs
.transactions
@@ -42,20 +47,12 @@ impl Query {
let first: usize = first_txindex.into();
let next: usize = next_first_txindex.into();
let txids: Vec<Txid> = indexer
.vecs
.transactions
.txid
.collect_range_at(first, next);
let txids: Vec<Txid> = indexer.vecs.transactions.txid.collect_range_at(first, next);
Ok(txids)
}
fn block_txs_by_height(
&self,
height: Height,
start_index: usize,
) -> Result<Vec<Transaction>> {
fn block_txs_by_height(&self, height: Height, start_index: usize) -> Result<Vec<Transaction>> {
let indexer = self.indexer();
let max_height = self.height();
@@ -63,7 +60,12 @@ impl Query {
return Err(Error::OutOfRange("Block height out of range".into()));
}
let first_txindex = indexer.vecs.transactions.first_txindex.collect_one(height).unwrap();
let first_txindex = indexer
.vecs
.transactions
.first_txindex
.collect_one(height)
.unwrap();
let next_first_txindex = indexer
.vecs
.transactions
@@ -100,7 +102,12 @@ impl Query {
return Err(Error::OutOfRange("Block height out of range".into()));
}
let first_txindex = indexer.vecs.transactions.first_txindex.collect_one(height).unwrap();
let first_txindex = indexer
.vecs
.transactions
.first_txindex
.collect_one(height)
.unwrap();
let next_first_txindex = indexer
.vecs
.transactions