general: snapshot

This commit is contained in:
k
2024-08-26 01:23:48 +02:00
parent 6ebd9320db
commit e206b40468
73 changed files with 34076 additions and 1237 deletions

View File

@@ -59,6 +59,7 @@ impl AddressData {
self.outputs_len -= 1;
let previous_sent_dollar_value = previous_price * amount;
self.realized_cap -= previous_sent_dollar_value;
Ok(())

View File

@@ -15,11 +15,3 @@ impl BlockPath {
}
}
}
impl std::hash::Hash for BlockPath {
fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) {
hasher.write_u32(((self.date_index as u32) << 16_u32) + self.block_index as u32)
}
}
// impl nohash::IsEnabled for BlockPath {}

View File

@@ -19,6 +19,7 @@ where
Key: MapKey<ChunkId>,
Value: MapValue,
{
#[inline(always)]
fn new(version: u32) -> Self {
Self {
version,
@@ -30,14 +31,17 @@ where
Some(Key::from_usize(chunk_id.to_usize() + self.map.len()))
}
#[inline(always)]
fn version(&self) -> u32 {
self.version
}
#[inline(always)]
fn get(&self, serialized_key: &Key) -> Option<&Value> {
self.map.get(serialized_key.to_usize())
}
#[inline(always)]
fn last(&self) -> Option<&Value> {
self.map.last()
}

View File

@@ -12,6 +12,7 @@ pub struct TxData {
direct_repr!(TxData);
impl TxData {
#[inline(always)]
pub fn new(index: u32, block_path: BlockPath, utxos: u16) -> Self {
Self {
index,

View File

@@ -10,19 +10,13 @@ pub struct TxoutIndex {
direct_repr!(TxoutIndex);
impl TxoutIndex {
#[inline(always)]
pub fn new(tx_index: u32, vout: u16) -> Self {
Self { tx_index, vout }
}
#[inline(always)]
pub fn as_u64(&self) -> u64 {
((self.tx_index as u64) << 16_u64) + self.vout as u64
}
}
impl std::hash::Hash for TxoutIndex {
fn hash<H: std::hash::Hasher>(&self, hasher: &mut H) {
hasher.write_u64(self.as_u64())
}
}
// impl nohash::IsEnabled for TxoutIndex {}