global: fixes

This commit is contained in:
nym21
2025-11-26 22:46:58 +01:00
parent 9e41d51702
commit 30dc695741
4 changed files with 20 additions and 19 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ pub use vecs::*;
// Increment on **change _OR_ addition** // Increment on **change _OR_ addition**
const VERSION: Version = Version::new(23); const VERSION: Version = Version::new(23);
const SNAPSHOT_BLOCK_RANGE: usize = 1_000; const SNAPSHOT_BLOCK_RANGE: usize = 1_000;
const COLLISIONS_CHECKED_UP_TO: Height = Height::new(920_000); const COLLISIONS_CHECKED_UP_TO: Height = Height::new(0);
#[derive(Clone)] #[derive(Clone)]
pub struct Indexer { pub struct Indexer {
+13 -9
View File
@@ -1,12 +1,12 @@
use std::{fs, path::Path}; use std::{fs, path::Path, str::FromStr};
use brk_error::Result; use brk_error::Result;
use brk_grouper::ByAddressType; use brk_grouper::ByAddressType;
use brk_store::{AnyStore, Mode, StoreFjallV2 as Store, Type}; use brk_store::{AnyStore, Mode, StoreFjallV2 as Store, Type};
use brk_types::{ use brk_types::{
AddressBytes, AddressHash, AddressIndexOutPoint, AddressIndexTxIndex, BlockHashPrefix, Height, AddressBytes, AddressHash, AddressIndexOutPoint, AddressIndexTxIndex, BlockHashPrefix, Height,
OutPoint, OutputType, StoredString, TxIndex, TxOutIndex, TxidPrefix, TypeIndex, Unit, Version, OutPoint, OutputType, StoredString, TxIndex, TxOutIndex, Txid, TxidPrefix, TypeIndex, Unit,
Vout, Version, Vout,
}; };
use fjall2::{CompressionType as Compression, PersistMode, TransactionalKeyspace}; use fjall2::{CompressionType as Compression, PersistMode, TransactionalKeyspace};
use rayon::prelude::*; use rayon::prelude::*;
@@ -366,6 +366,12 @@ impl Stores {
} }
if starting_indexes.txindex != TxIndex::ZERO { if starting_indexes.txindex != TxIndex::ZERO {
let txidprefix_dup1 = TxidPrefix::from(Txid::from(bitcoin::Txid::from_str(
"d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599",
)?));
let txidprefix_dup2 = TxidPrefix::from(Txid::from(bitcoin::Txid::from_str(
"e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468",
)?));
vecs.txindex_to_txid vecs.txindex_to_txid
.iter()? .iter()?
.enumerate() .enumerate()
@@ -375,13 +381,11 @@ impl Stores {
let txidprefix = TxidPrefix::from(&txid); let txidprefix = TxidPrefix::from(&txid);
// "d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599" let is_not_first_dup =
let is_not_first_dup = txindex != TxIndex::new(142783) txindex != TxIndex::new(142783) || txidprefix != txidprefix_dup1;
|| txidprefix != TxidPrefix::from([153, 133, 216, 41, 84, 225, 15, 34]);
// "e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468" let is_not_second_dup =
let is_not_second_dup = txindex != TxIndex::new(142841) txindex != TxIndex::new(142841) || txidprefix != txidprefix_dup2;
|| txidprefix != TxidPrefix::from([104, 180, 95, 88, 182, 116, 233, 78]);
if is_not_first_dup && is_not_second_dup { if is_not_first_dup && is_not_second_dup {
self.txidprefix_to_txindex.remove(txidprefix); self.txidprefix_to_txindex.remove(txidprefix);
+3 -1
View File
@@ -16,7 +16,9 @@ impl From<BlockHash> for BlockHashPrefix {
impl From<&BlockHash> for BlockHashPrefix { impl From<&BlockHash> for BlockHashPrefix {
#[inline] #[inline]
fn from(value: &BlockHash) -> Self { fn from(value: &BlockHash) -> Self {
Self(u64::from_ne_bytes(value.as_slice().try_into().unwrap())) Self(u64::from_ne_bytes(
value.as_slice()[0..8].try_into().unwrap(),
))
} }
} }
+3 -8
View File
@@ -16,7 +16,9 @@ impl From<Txid> for TxidPrefix {
impl From<&Txid> for TxidPrefix { impl From<&Txid> for TxidPrefix {
#[inline] #[inline]
fn from(value: &Txid) -> Self { fn from(value: &Txid) -> Self {
Self(u64::from_ne_bytes(value.as_slice().try_into().unwrap())) Self(u64::from_ne_bytes(
value.as_slice()[0..8].try_into().unwrap(),
))
} }
} }
@@ -40,10 +42,3 @@ impl From<&TxidPrefix> for ByteView {
Self::from(value.to_be_bytes()) Self::from(value.to_be_bytes())
} }
} }
impl From<[u8; 8]> for TxidPrefix {
#[inline]
fn from(value: [u8; 8]) -> Self {
Self(u64::from_ne_bytes(value))
}
}