mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: fixes
This commit is contained in:
@@ -30,7 +30,7 @@ pub use vecs::*;
|
||||
// Increment on **change _OR_ addition**
|
||||
const VERSION: Version = Version::new(23);
|
||||
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)]
|
||||
pub struct Indexer {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
use std::{fs, path::Path};
|
||||
use std::{fs, path::Path, str::FromStr};
|
||||
|
||||
use brk_error::Result;
|
||||
use brk_grouper::ByAddressType;
|
||||
use brk_store::{AnyStore, Mode, StoreFjallV2 as Store, Type};
|
||||
use brk_types::{
|
||||
AddressBytes, AddressHash, AddressIndexOutPoint, AddressIndexTxIndex, BlockHashPrefix, Height,
|
||||
OutPoint, OutputType, StoredString, TxIndex, TxOutIndex, TxidPrefix, TypeIndex, Unit, Version,
|
||||
Vout,
|
||||
OutPoint, OutputType, StoredString, TxIndex, TxOutIndex, Txid, TxidPrefix, TypeIndex, Unit,
|
||||
Version, Vout,
|
||||
};
|
||||
use fjall2::{CompressionType as Compression, PersistMode, TransactionalKeyspace};
|
||||
use rayon::prelude::*;
|
||||
@@ -366,6 +366,12 @@ impl Stores {
|
||||
}
|
||||
|
||||
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
|
||||
.iter()?
|
||||
.enumerate()
|
||||
@@ -375,13 +381,11 @@ impl Stores {
|
||||
|
||||
let txidprefix = TxidPrefix::from(&txid);
|
||||
|
||||
// "d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599"
|
||||
let is_not_first_dup = txindex != TxIndex::new(142783)
|
||||
|| txidprefix != TxidPrefix::from([153, 133, 216, 41, 84, 225, 15, 34]);
|
||||
let is_not_first_dup =
|
||||
txindex != TxIndex::new(142783) || txidprefix != txidprefix_dup1;
|
||||
|
||||
// "e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468"
|
||||
let is_not_second_dup = txindex != TxIndex::new(142841)
|
||||
|| txidprefix != TxidPrefix::from([104, 180, 95, 88, 182, 116, 233, 78]);
|
||||
let is_not_second_dup =
|
||||
txindex != TxIndex::new(142841) || txidprefix != txidprefix_dup2;
|
||||
|
||||
if is_not_first_dup && is_not_second_dup {
|
||||
self.txidprefix_to_txindex.remove(txidprefix);
|
||||
|
||||
@@ -16,7 +16,9 @@ impl From<BlockHash> for BlockHashPrefix {
|
||||
impl From<&BlockHash> for BlockHashPrefix {
|
||||
#[inline]
|
||||
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(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,9 @@ impl From<Txid> for TxidPrefix {
|
||||
impl From<&Txid> for TxidPrefix {
|
||||
#[inline]
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<[u8; 8]> for TxidPrefix {
|
||||
#[inline]
|
||||
fn from(value: [u8; 8]) -> Self {
|
||||
Self(u64::from_ne_bytes(value))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user