mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-08 06:01:57 -07:00
computer: store part 5
This commit is contained in:
@@ -12,7 +12,9 @@ use brk_store::{AnyStore, Store};
|
||||
use fjall::{PersistMode, TransactionalKeyspace};
|
||||
use rayon::prelude::*;
|
||||
|
||||
use crate::vecs::stateful::AddressTypeToTypeIndexVec;
|
||||
use crate::vecs::stateful::{
|
||||
AddressTypeToTypeIndexTree, AddressTypeToTypeIndexVec, WithAddressDataSource,
|
||||
};
|
||||
|
||||
const VERSION: Version = Version::ZERO;
|
||||
|
||||
@@ -572,43 +574,234 @@ impl Stores {
|
||||
})
|
||||
}
|
||||
|
||||
// pub fn emptyaddressdata_store_increase_replaced(&mut self, address_type: OutputType) {
|
||||
// match address_type {
|
||||
// OutputType::P2A => self.p2aaddressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2PK33 => self.p2pk33addressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2PK65 => self.p2pk65addressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2PKH => self.p2pkhaddressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2SH => self.p2shaddressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2TR => self.p2traddressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2WPKH => self.p2wpkhaddressindex_to_addressdata.increase_replaced(),
|
||||
// OutputType::P2WSH => self.p2wshaddressindex_to_addressdata.increase_replaced(),
|
||||
// _ => unreachable!(),
|
||||
// }
|
||||
// }
|
||||
|
||||
pub fn commit(
|
||||
&mut self,
|
||||
height: Height,
|
||||
sent: AddressTypeToTypeIndexVec<OutputIndex>,
|
||||
received: AddressTypeToTypeIndexVec<OutputIndex>,
|
||||
addresstype_to_typeindex_to_addressdata: AddressTypeToTypeIndexTree<
|
||||
WithAddressDataSource<AddressData>,
|
||||
>,
|
||||
addresstype_to_typeindex_to_emptyaddressdata: AddressTypeToTypeIndexTree<
|
||||
WithAddressDataSource<EmptyAddressData>,
|
||||
>,
|
||||
) -> Result<()> {
|
||||
// &mut self.p2aaddressindex_to_addressdata,
|
||||
// &mut self.p2pk33addressindex_to_addressdata,
|
||||
// &mut self.p2pk65addressindex_to_addressdata,
|
||||
// &mut self.p2pkhaddressindex_to_addressdata,
|
||||
// &mut self.p2shaddressindex_to_addressdata,
|
||||
// &mut self.p2traddressindex_to_addressdata,
|
||||
// &mut self.p2wpkhaddressindex_to_addressdata,
|
||||
// &mut self.p2wshaddressindex_to_addressdata,
|
||||
let GroupedByAddressType {
|
||||
p2pk65,
|
||||
p2pk33,
|
||||
p2pkh,
|
||||
p2sh,
|
||||
p2wpkh,
|
||||
p2wsh,
|
||||
p2tr,
|
||||
p2a,
|
||||
} = addresstype_to_typeindex_to_addressdata.unwrap();
|
||||
|
||||
// &mut self.p2aaddressindex_to_emptyaddressdata,
|
||||
// &mut self.p2pk33addressindex_to_emptyaddressdata,
|
||||
// &mut self.p2pk65addressindex_to_emptyaddressdata,
|
||||
// &mut self.p2pkhaddressindex_to_emptyaddressdata,
|
||||
// &mut self.p2shaddressindex_to_emptyaddressdata,
|
||||
// &mut self.p2traddressindex_to_emptyaddressdata,
|
||||
// &mut self.p2wpkhaddressindex_to_emptyaddressdata,
|
||||
// &mut self.p2wshaddressindex_to_emptyaddressdata,
|
||||
let GroupedByAddressType {
|
||||
p2pk65: empty_p2pk65,
|
||||
p2pk33: empty_p2pk33,
|
||||
p2pkh: empty_p2pkh,
|
||||
p2sh: empty_p2sh,
|
||||
p2wpkh: empty_p2wpkh,
|
||||
p2wsh: empty_p2wsh,
|
||||
p2tr: empty_p2tr,
|
||||
p2a: empty_p2a,
|
||||
} = addresstype_to_typeindex_to_emptyaddressdata.unwrap();
|
||||
|
||||
thread::scope(|s| {
|
||||
s.spawn(|| {
|
||||
self.p2aaddressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2a
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2a.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2pk33addressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2pk33
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2pk33.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2pk65addressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2pk65
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2pk65.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2pkhaddressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2pkh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2pkh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2shaddressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2sh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2sh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2traddressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2tr
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2tr.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2wpkhaddressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2wpkh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2wpkh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
s.spawn(|| {
|
||||
self.p2wshaddressindex_to_addressdata.commit_(
|
||||
height,
|
||||
empty_p2wsh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_addressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
p2wsh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
thread::scope(|scope| {
|
||||
scope.spawn(|| {
|
||||
self.p2aaddressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2a.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2a.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2pk33addressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2pk33
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2pk33.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2pk65addressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2pk65
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2pk65.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2pkhaddressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2pkh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2pkh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2shaddressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2sh.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2sh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2traddressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2tr.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2tr.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2wpkhaddressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2wpkh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2wpkh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
scope.spawn(|| {
|
||||
self.p2wshaddressindex_to_emptyaddressdata.commit_(
|
||||
height,
|
||||
p2wsh
|
||||
.iter()
|
||||
.filter(|(_, addressdata)| addressdata.is_from_emptyaddressdata())
|
||||
.map(|(typeindex, _)| (*typeindex).into()),
|
||||
empty_p2wsh.iter().map(|(typeindex, addressdata)| {
|
||||
((*typeindex).into(), addressdata.deref().clone())
|
||||
}),
|
||||
)
|
||||
});
|
||||
});
|
||||
|
||||
thread::scope(|s| {
|
||||
let GroupedByAddressType {
|
||||
|
||||
@@ -3,8 +3,10 @@ use std::{ops::Deref, path::Path};
|
||||
use brk_core::{Bitcoin, DateIndex, Dollars, Height, Result, StoredUsize, Version};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_state::{AddressCohortState, CohortStateTrait};
|
||||
use brk_vec::{AnyCollectableVec, AnyIterableVec, AnyVec, Computation, EagerVec, Format};
|
||||
use brk_state::AddressCohortState;
|
||||
use brk_vec::{
|
||||
AnyCollectableVec, AnyIterableVec, AnyVec, Computation, EagerVec, Format, VecIterator,
|
||||
};
|
||||
|
||||
use crate::vecs::{
|
||||
Indexes, fetched, indexes, market,
|
||||
@@ -68,6 +70,7 @@ impl CohortVecs for Vecs {
|
||||
fn starting_height(&self) -> Height {
|
||||
[
|
||||
self.state
|
||||
.inner
|
||||
.price_to_amount
|
||||
.height()
|
||||
.map_or(Height::MAX, |h| h.incremented()),
|
||||
@@ -86,7 +89,15 @@ impl CohortVecs for Vecs {
|
||||
|
||||
self.starting_height = starting_height;
|
||||
|
||||
self.inner.init(&mut self.starting_height, &mut self.state);
|
||||
if let Some(prev_height) = starting_height.decremented() {
|
||||
self.state.address_count = *self
|
||||
.height_to_address_count
|
||||
.into_iter()
|
||||
.unwrap_get_inner(prev_height);
|
||||
}
|
||||
|
||||
self.inner
|
||||
.init(&mut self.starting_height, &mut self.state.inner);
|
||||
}
|
||||
|
||||
fn validate_computed_versions(&mut self, base_version: Version) -> Result<()> {
|
||||
@@ -109,7 +120,7 @@ impl CohortVecs for Vecs {
|
||||
exit,
|
||||
)?;
|
||||
|
||||
self.inner.forced_pushed_at(height, exit, &self.state)
|
||||
self.inner.forced_pushed_at(height, exit, &self.state.inner)
|
||||
}
|
||||
|
||||
fn compute_then_force_push_unrealized_states(
|
||||
@@ -126,7 +137,7 @@ impl CohortVecs for Vecs {
|
||||
dateindex,
|
||||
date_price,
|
||||
exit,
|
||||
&self.state,
|
||||
&self.state.inner,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -134,7 +145,7 @@ impl CohortVecs for Vecs {
|
||||
self.height_to_address_count.safe_flush(exit)?;
|
||||
|
||||
self.inner
|
||||
.safe_flush_stateful_vecs(height, exit, &mut self.state)
|
||||
.safe_flush_stateful_vecs(height, exit, &mut self.state.inner)
|
||||
}
|
||||
|
||||
fn compute_from_stateful(
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
use std::path::Path;
|
||||
|
||||
use brk_core::{
|
||||
AddressGroups, GroupFilter, GroupedByFromSize, GroupedBySizeRange, GroupedByUpToSize, Version,
|
||||
AddressGroups, GroupFilter, GroupedByFromSize, GroupedBySizeRange, GroupedByUpToSize, Result,
|
||||
Version,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use brk_vec::{Computation, Format};
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use rayon::prelude::*;
|
||||
|
||||
use crate::vecs::{
|
||||
fetched,
|
||||
Indexes, fetched,
|
||||
stateful::{address_cohort, r#trait::CohortVecs},
|
||||
};
|
||||
|
||||
const VERSION: Version = Version::new(0);
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Deref, DerefMut)]
|
||||
pub struct Vecs(AddressGroups<(GroupFilter, address_cohort::Vecs)>);
|
||||
|
||||
impl Vecs {
|
||||
@@ -276,4 +280,50 @@ impl Vecs {
|
||||
.into(),
|
||||
))
|
||||
}
|
||||
|
||||
pub fn compute_overlapping_vecs(
|
||||
&mut self,
|
||||
starting_indexes: &Indexes,
|
||||
exit: &Exit,
|
||||
) -> Result<()> {
|
||||
let by_size_range = self.0.by_size_range.as_vec();
|
||||
|
||||
[
|
||||
self.0
|
||||
.by_from_size
|
||||
.as_mut_vec()
|
||||
.into_iter()
|
||||
.map(|(filter, vecs)| {
|
||||
(
|
||||
vecs,
|
||||
by_size_range
|
||||
.into_iter()
|
||||
.filter(|(other, _)| filter.includes(other))
|
||||
.map(|(_, v)| v)
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
self.0
|
||||
.by_up_to_size
|
||||
.as_mut_vec()
|
||||
.into_iter()
|
||||
.map(|(filter, vecs)| {
|
||||
(
|
||||
vecs,
|
||||
by_size_range
|
||||
.into_iter()
|
||||
.filter(|(other, _)| filter.includes(other))
|
||||
.map(|(_, v)| v)
|
||||
.collect::<Vec<_>>(),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
]
|
||||
.into_par_iter()
|
||||
.flatten()
|
||||
.try_for_each(|(vecs, stateful)| {
|
||||
vecs.compute_from_stateful(starting_indexes, &stateful, exit)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ impl<T> AddressTypeToTypeIndexTree<T> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn inner(self) -> GroupedByAddressType<BTreeMap<TypeIndex, T>> {
|
||||
pub fn unwrap(self) -> GroupedByAddressType<BTreeMap<TypeIndex, T>> {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
use brk_core::{AddressData, EmptyAddressData};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum AnyAddressData {
|
||||
AddressData(AddressData),
|
||||
EmptyAddressData(EmptyAddressData),
|
||||
}
|
||||
|
||||
impl From<AddressData> for AnyAddressData {
|
||||
fn from(value: AddressData) -> Self {
|
||||
Self::AddressData(value)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<EmptyAddressData> for AnyAddressData {
|
||||
fn from(value: EmptyAddressData) -> Self {
|
||||
Self::EmptyAddressData(value)
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ use brk_core::{
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_state::{CohortState, CohortStateTrait};
|
||||
use brk_state::CohortState;
|
||||
use brk_vec::{
|
||||
AnyCollectableVec, AnyIterableVec, AnyVec, Computation, EagerVec, Format, VecIterator,
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ use brk_vec::{
|
||||
use log::info;
|
||||
use rayon::prelude::*;
|
||||
|
||||
use brk_state::{BlockState, CohortStateTrait, SupplyState, Transacted};
|
||||
use brk_state::{BlockState, SupplyState, Transacted};
|
||||
|
||||
use crate::{stores::Stores, vecs::market};
|
||||
|
||||
@@ -27,17 +27,16 @@ mod address_cohort;
|
||||
mod address_cohorts;
|
||||
mod addresstype_to_typeindex_tree;
|
||||
mod addresstype_to_typeindex_vec;
|
||||
mod anyaddressdata;
|
||||
mod common;
|
||||
mod r#trait;
|
||||
mod utxo_cohort;
|
||||
mod utxo_cohorts;
|
||||
mod withaddressdatasource;
|
||||
|
||||
use addresstype_to_typeindex_tree::*;
|
||||
pub use addresstype_to_typeindex_tree::*;
|
||||
pub use addresstype_to_typeindex_vec::*;
|
||||
use r#trait::CohortVecs;
|
||||
use withaddressdatasource::WithAddressDataSource;
|
||||
pub use withaddressdatasource::WithAddressDataSource;
|
||||
|
||||
const VERSION: Version = Version::new(5);
|
||||
|
||||
@@ -229,6 +228,7 @@ impl Vecs {
|
||||
let outputindex_to_typeindex_mmap = outputindex_to_typeindex.mmap().load();
|
||||
let outputindex_to_txindex_mmap = outputindex_to_txindex.mmap().load();
|
||||
let txindex_to_height_mmap = txindex_to_height.mmap().load();
|
||||
let height_to_close_mmap = height_to_close.map(|v| v.mmap().load());
|
||||
|
||||
let mut height_to_first_outputindex_iter = height_to_first_outputindex.into_iter();
|
||||
let mut height_to_first_inputindex_iter = height_to_first_inputindex.into_iter();
|
||||
@@ -378,6 +378,11 @@ impl Vecs {
|
||||
.iter_mut()
|
||||
.for_each(|(_, v)| v.state.reset_single_iteration_values());
|
||||
|
||||
self.address_vecs
|
||||
.as_mut_separate_vecs()
|
||||
.iter_mut()
|
||||
.for_each(|(_, v)| v.state.reset_single_iteration_values());
|
||||
|
||||
info!("Processing chain at {height}...");
|
||||
|
||||
let timestamp = height_to_timestamp_fixed_iter.unwrap_get_inner(height);
|
||||
@@ -453,23 +458,27 @@ impl Vecs {
|
||||
.unwrap()
|
||||
.into_owned();
|
||||
|
||||
(height, value, input_type, typeindex, outputindex, addressdata_opt)
|
||||
let dollars_opt = height_to_close.map(|m| *m.get_or_read(height, height_to_close_mmap.as_ref().unwrap()).unwrap()
|
||||
.unwrap()
|
||||
.into_owned());
|
||||
|
||||
(height, value, input_type, typeindex, outputindex, addressdata_opt, dollars_opt)
|
||||
})
|
||||
.fold(
|
||||
|| {
|
||||
(
|
||||
BTreeMap::<Height, Transacted>::default(),
|
||||
AddressTypeToTypeIndexVec::<OutputIndex>::default(),
|
||||
AddressTypeToTypeIndexVec::<(Sats, Option<WithAddressDataSource<AddressData>>)>::default(),
|
||||
AddressTypeToTypeIndexVec::<(Sats, Option<WithAddressDataSource<AddressData>>, Option<Dollars>)>::default(),
|
||||
)
|
||||
},
|
||||
|(mut tree, mut vecs, mut vecs2), (height, value, input_type, typeindex, outputindex, addressdata_opt)| {
|
||||
|(mut tree, mut vecs, mut vecs2), (height, value, input_type, typeindex, outputindex, addressdata_opt, dollars_opt)| {
|
||||
tree.entry(height).or_default().iterate(value, input_type);
|
||||
if let Some(vec) = vecs.get_mut(input_type) {
|
||||
vec.push((typeindex, outputindex));
|
||||
}
|
||||
if let Some(vec) = vecs2.get_mut(input_type) {
|
||||
vec.push((typeindex, (value, addressdata_opt)));
|
||||
vec.push((typeindex, (value, addressdata_opt, dollars_opt)));
|
||||
}
|
||||
(tree, vecs, vecs2)
|
||||
},
|
||||
@@ -478,7 +487,7 @@ impl Vecs {
|
||||
(
|
||||
BTreeMap::<Height, Transacted>::default(),
|
||||
AddressTypeToTypeIndexVec::<OutputIndex>::default(),
|
||||
AddressTypeToTypeIndexVec::<(Sats, Option<WithAddressDataSource<AddressData>>)>::default(),
|
||||
AddressTypeToTypeIndexVec::<(Sats, Option<WithAddressDataSource<AddressData>>, Option<Dollars>)>::default(),
|
||||
)
|
||||
}, |(first_tree, mut source_vecs,mut source_vecs2), (second_tree, other_vecs, other_vecs2)| {
|
||||
let (mut tree_source, tree_to_consume) = if first_tree.len() > second_tree.len() {
|
||||
@@ -562,7 +571,9 @@ impl Vecs {
|
||||
addresstype_to_typeindex_to_sent_outputindex.merge(new_addresstype_to_typedindex_to_sent_outputindex);
|
||||
addresstype_to_typeindex_to_received_outputindex.merge(new_addresstype_to_typedindex_to_received_outputindex);
|
||||
|
||||
addresstype_to_typedindex_to_received_sats_and_addressdata_opt.process_received(&mut addresstype_to_typeindex_to_addressdata, &mut addresstype_to_typeindex_to_emptyaddressdata, price);
|
||||
addresstype_to_typedindex_to_received_sats_and_addressdata_opt.process_received(&mut self.address_vecs, &mut addresstype_to_typeindex_to_addressdata, &mut addresstype_to_typeindex_to_emptyaddressdata, price);
|
||||
|
||||
addresstype_to_typedindex_to_sent_sats_and_addressdata_opt.process_sent(&mut self.address_vecs, &mut addresstype_to_typeindex_to_addressdata)?;
|
||||
|
||||
// addresstype_to_typedindex_to_sent_sats_and_addressdata_opt;
|
||||
// take from addressdata store
|
||||
@@ -665,7 +676,8 @@ impl Vecs {
|
||||
stores.commit(
|
||||
height,
|
||||
mem::take(&mut addresstype_to_typeindex_to_sent_outputindex),
|
||||
mem::take( &mut addresstype_to_typeindex_to_received_outputindex)
|
||||
mem::take(&mut addresstype_to_typeindex_to_received_outputindex),
|
||||
mem::take(&mut addresstype_to_typeindex_to_addressdata), mem::take(&mut addresstype_to_typeindex_to_emptyaddressdata)
|
||||
)?;
|
||||
exit.release();
|
||||
}
|
||||
@@ -682,6 +694,8 @@ impl Vecs {
|
||||
height,
|
||||
mem::take(&mut addresstype_to_typeindex_to_sent_outputindex),
|
||||
mem::take(&mut addresstype_to_typeindex_to_received_outputindex),
|
||||
mem::take(&mut addresstype_to_typeindex_to_addressdata),
|
||||
mem::take(&mut addresstype_to_typeindex_to_emptyaddressdata),
|
||||
)?;
|
||||
} else {
|
||||
exit.block();
|
||||
@@ -807,6 +821,7 @@ impl Vecs {
|
||||
impl AddressTypeToTypeIndexVec<(Sats, Option<WithAddressDataSource<AddressData>>)> {
|
||||
fn process_received(
|
||||
mut self,
|
||||
vecs: &mut address_cohorts::Vecs,
|
||||
addresstype_to_typeindex_to_addressdata: &mut AddressTypeToTypeIndexTree<
|
||||
WithAddressDataSource<AddressData>,
|
||||
>,
|
||||
@@ -818,7 +833,7 @@ impl AddressTypeToTypeIndexVec<(Sats, Option<WithAddressDataSource<AddressData>>
|
||||
self.into_typed_vec().into_iter().for_each(|(_type, vec)| {
|
||||
vec.into_iter()
|
||||
.for_each(|(type_index, (value, addressdata_opt))| {
|
||||
addresstype_to_typeindex_to_addressdata
|
||||
let addressdata_withsource = addresstype_to_typeindex_to_addressdata
|
||||
.get_mut(_type)
|
||||
.unwrap()
|
||||
.entry(type_index)
|
||||
@@ -831,37 +846,61 @@ impl AddressTypeToTypeIndexVec<(Sats, Option<WithAddressDataSource<AddressData>>
|
||||
.unwrap()
|
||||
.into()
|
||||
})
|
||||
})
|
||||
.deref_mut()
|
||||
.receive(value, price);
|
||||
});
|
||||
|
||||
// update vecs states if cohort changes
|
||||
let addressdata = addressdata_withsource.deref_mut();
|
||||
|
||||
let prev_filter = vecs.by_size_range.get_mut(addressdata.amount()).0.clone();
|
||||
|
||||
addressdata.receive(value, price);
|
||||
|
||||
let (filter, vecs) = vecs.by_size_range.get_mut(addressdata.amount());
|
||||
|
||||
if *filter != prev_filter {
|
||||
// vecs.state.decrement(supply_state, price);
|
||||
}
|
||||
|
||||
// update vecs states if cohort changes groups
|
||||
//
|
||||
// empty addresses ?
|
||||
//
|
||||
// count change ?
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl
|
||||
AddressTypeToTypeIndexVec<(
|
||||
Sats,
|
||||
Option<WithAddressDataSource<AddressData>>,
|
||||
Option<Dollars>,
|
||||
)>
|
||||
{
|
||||
fn process_sent(
|
||||
mut self,
|
||||
vecs: &mut address_cohorts::Vecs,
|
||||
addresstype_to_typeindex_to_addressdata: &mut AddressTypeToTypeIndexTree<
|
||||
WithAddressDataSource<AddressData>,
|
||||
>,
|
||||
price: Option<Dollars>,
|
||||
) -> Result<()> {
|
||||
self.into_typed_vec()
|
||||
.into_iter()
|
||||
.try_for_each(|(_type, vec)| {
|
||||
vec.into_iter()
|
||||
.try_for_each(|(type_index, (value, addressdata_opt))| {
|
||||
addresstype_to_typeindex_to_addressdata
|
||||
.try_for_each(|(type_index, (value, addressdata_opt, price))| {
|
||||
let addressdata_withsource = addresstype_to_typeindex_to_addressdata
|
||||
.get_mut(_type)
|
||||
.unwrap()
|
||||
.entry(type_index)
|
||||
.or_insert(addressdata_opt.unwrap())
|
||||
.deref_mut()
|
||||
.send(value, price)?;
|
||||
.or_insert(addressdata_opt.unwrap());
|
||||
|
||||
addressdata_withsource.deref_mut().send(value, price)?;
|
||||
|
||||
Ok(())
|
||||
|
||||
// move to empty if empty
|
||||
|
||||
// update vecs states if cohort changes
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::{ops::Deref, path::Path};
|
||||
use brk_core::{Bitcoin, DateIndex, Dollars, Height, Result, Version};
|
||||
use brk_exit::Exit;
|
||||
use brk_indexer::Indexer;
|
||||
use brk_state::{CohortStateTrait, UTXOCohortState};
|
||||
use brk_state::UTXOCohortState;
|
||||
use brk_vec::{AnyCollectableVec, AnyIterableVec, Computation, Format};
|
||||
|
||||
use crate::vecs::{
|
||||
|
||||
@@ -7,7 +7,7 @@ use brk_core::{
|
||||
Version,
|
||||
};
|
||||
use brk_exit::Exit;
|
||||
use brk_state::{BlockState, CohortStateTrait, Transacted};
|
||||
use brk_state::{BlockState, Transacted};
|
||||
use brk_vec::{Computation, Format, StoredIndex};
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
use rayon::prelude::*;
|
||||
@@ -1103,7 +1103,7 @@ impl Vecs {
|
||||
.timestamp
|
||||
.difference_in_days_between(last_timestamp);
|
||||
|
||||
let days_old_foat = block_state
|
||||
let days_old_float = block_state
|
||||
.timestamp
|
||||
.difference_in_days_between_float(last_timestamp);
|
||||
|
||||
@@ -1127,7 +1127,7 @@ impl Vecs {
|
||||
current_price,
|
||||
prev_price,
|
||||
blocks_old,
|
||||
days_old_foat,
|
||||
days_old_float,
|
||||
older_than_hour,
|
||||
);
|
||||
});
|
||||
@@ -1139,7 +1139,7 @@ impl Vecs {
|
||||
current_price,
|
||||
prev_price,
|
||||
blocks_old,
|
||||
days_old_foat,
|
||||
days_old_float,
|
||||
older_than_hour,
|
||||
)
|
||||
},
|
||||
@@ -1154,7 +1154,7 @@ impl Vecs {
|
||||
current_price,
|
||||
prev_price,
|
||||
blocks_old,
|
||||
days_old_foat,
|
||||
days_old_float,
|
||||
older_than_hour,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -12,6 +12,14 @@ impl<T> WithAddressDataSource<T> {
|
||||
matches!(self, Self::New(_))
|
||||
}
|
||||
|
||||
pub fn is_from_addressdata(&self) -> bool {
|
||||
matches!(self, Self::FromAddressDataStore(_))
|
||||
}
|
||||
|
||||
pub fn is_from_emptyaddressdata(&self) -> bool {
|
||||
matches!(self, Self::FromEmptyAddressDataStore(_))
|
||||
}
|
||||
|
||||
pub fn deref(&self) -> &T {
|
||||
match self {
|
||||
Self::New(v) => v,
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
mod error;
|
||||
|
||||
pub use error::*;
|
||||
@@ -2,7 +2,7 @@ use std::ops::Range;
|
||||
|
||||
use crate::{HalvingEpoch, OutputType};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum GroupFilter {
|
||||
All,
|
||||
To(usize),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
|
||||
mod enums;
|
||||
mod error;
|
||||
mod groups;
|
||||
mod structs;
|
||||
mod traits;
|
||||
mod utils;
|
||||
|
||||
pub use enums::*;
|
||||
pub use error::*;
|
||||
pub use groups::*;
|
||||
pub use structs::*;
|
||||
pub use traits::*;
|
||||
|
||||
@@ -5,7 +5,7 @@ use std::{
|
||||
|
||||
use brk_core::{Dollars, Height, Result};
|
||||
|
||||
use crate::{CohortStateTrait, SupplyState, UnrealizedState};
|
||||
use crate::{SupplyState, UnrealizedState};
|
||||
|
||||
use super::CohortState;
|
||||
|
||||
@@ -15,76 +15,77 @@ pub struct AddressCohortState {
|
||||
pub inner: CohortState,
|
||||
}
|
||||
|
||||
impl CohortStateTrait for AddressCohortState {
|
||||
fn default_and_import(path: &Path, name: &str, compute_dollars: bool) -> Result<Self> {
|
||||
impl AddressCohortState {
|
||||
pub fn default_and_import(path: &Path, name: &str, compute_dollars: bool) -> Result<Self> {
|
||||
Ok(Self {
|
||||
address_count: 0,
|
||||
inner: CohortState::default_and_import(path, name, compute_dollars)?,
|
||||
})
|
||||
}
|
||||
|
||||
fn reset_single_iteration_values(&mut self) {
|
||||
pub fn reset_single_iteration_values(&mut self) {
|
||||
self.inner.reset_single_iteration_values();
|
||||
}
|
||||
|
||||
fn increment(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.inner.increment(supply_state, price);
|
||||
}
|
||||
|
||||
fn decrement(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.inner.decrement(supply_state, price);
|
||||
}
|
||||
|
||||
fn decrement_price_to_amount(&mut self, supply_state: &SupplyState, price: Dollars) {
|
||||
self.inner.decrement_price_to_amount(supply_state, price);
|
||||
}
|
||||
|
||||
fn receive(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.inner.receive(supply_state, price);
|
||||
}
|
||||
|
||||
fn send(
|
||||
&mut self,
|
||||
supply_state: &SupplyState,
|
||||
current_price: Option<Dollars>,
|
||||
prev_price: Option<Dollars>,
|
||||
blocks_old: usize,
|
||||
days_old: f64,
|
||||
older_than_hour: bool,
|
||||
) {
|
||||
self.inner.send(
|
||||
supply_state,
|
||||
current_price,
|
||||
prev_price,
|
||||
blocks_old,
|
||||
days_old,
|
||||
older_than_hour,
|
||||
);
|
||||
}
|
||||
|
||||
fn compute_unrealized_states(
|
||||
&self,
|
||||
height_price: Dollars,
|
||||
date_price: Option<Dollars>,
|
||||
) -> (UnrealizedState, Option<UnrealizedState>) {
|
||||
self.inner
|
||||
.compute_unrealized_states(height_price, date_price)
|
||||
}
|
||||
|
||||
fn commit(&mut self, height: Height) -> Result<()> {
|
||||
self.inner.commit(height)
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for AddressCohortState {
|
||||
type Target = CohortState;
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
// fn increment(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
// self.inner.increment(supply_state, price);
|
||||
// }
|
||||
|
||||
impl DerefMut for AddressCohortState {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.inner
|
||||
}
|
||||
}
|
||||
// fn decrement(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
// self.inner.decrement(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn decrement_price_to_amount(&mut self, supply_state: &SupplyState, price: Dollars) {
|
||||
// self.inner.decrement_price_to_amount(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn receive(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
// self.inner.receive(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn send(
|
||||
// &mut self,
|
||||
// supply_state: &SupplyState,
|
||||
// current_price: Option<Dollars>,
|
||||
// prev_price: Option<Dollars>,
|
||||
// blocks_old: usize,
|
||||
// days_old: f64,
|
||||
// older_than_hour: bool,
|
||||
// ) {
|
||||
// self.inner.send(
|
||||
// supply_state,
|
||||
// current_price,
|
||||
// prev_price,
|
||||
// blocks_old,
|
||||
// days_old,
|
||||
// older_than_hour,
|
||||
// );
|
||||
// }
|
||||
|
||||
// fn compute_unrealized_states(
|
||||
// &self,
|
||||
// height_price: Dollars,
|
||||
// date_price: Option<Dollars>,
|
||||
// ) -> (UnrealizedState, Option<UnrealizedState>) {
|
||||
// self.inner
|
||||
// .compute_unrealized_states(height_price, date_price)
|
||||
// }
|
||||
|
||||
// fn commit(&mut self, height: Height) -> Result<()> {
|
||||
// self.inner.commit(height)
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl Deref for AddressCohortState {
|
||||
// type Target = CohortState;
|
||||
// fn deref(&self) -> &Self::Target {
|
||||
// &self.inner
|
||||
// }
|
||||
// }
|
||||
|
||||
// impl DerefMut for AddressCohortState {
|
||||
// fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
// &mut self.inner
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::{cmp::Ordering, path::Path};
|
||||
|
||||
use brk_core::{CheckedSub, Dollars, Height, Result, Sats};
|
||||
|
||||
use crate::{CohortStateTrait, PriceToAmount, RealizedState, SupplyState, UnrealizedState};
|
||||
use crate::{PriceToAmount, RealizedState, SupplyState, UnrealizedState};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct CohortState {
|
||||
@@ -13,8 +13,8 @@ pub struct CohortState {
|
||||
pub price_to_amount: PriceToAmount,
|
||||
}
|
||||
|
||||
impl CohortStateTrait for CohortState {
|
||||
fn default_and_import(path: &Path, name: &str, compute_dollars: bool) -> Result<Self> {
|
||||
impl CohortState {
|
||||
pub fn default_and_import(path: &Path, name: &str, compute_dollars: bool) -> Result<Self> {
|
||||
Ok(Self {
|
||||
supply: SupplyState::default(),
|
||||
realized: compute_dollars.then_some(RealizedState::NAN),
|
||||
@@ -24,7 +24,7 @@ impl CohortStateTrait for CohortState {
|
||||
})
|
||||
}
|
||||
|
||||
fn reset_single_iteration_values(&mut self) {
|
||||
pub fn reset_single_iteration_values(&mut self) {
|
||||
self.satdays_destroyed = Sats::ZERO;
|
||||
self.satblocks_destroyed = Sats::ZERO;
|
||||
if let Some(realized) = self.realized.as_mut() {
|
||||
@@ -32,7 +32,7 @@ impl CohortStateTrait for CohortState {
|
||||
}
|
||||
}
|
||||
|
||||
fn increment(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
pub fn increment(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.supply += supply_state;
|
||||
|
||||
if supply_state.value > Sats::ZERO {
|
||||
@@ -44,7 +44,7 @@ impl CohortStateTrait for CohortState {
|
||||
}
|
||||
}
|
||||
|
||||
fn decrement(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
pub fn decrement(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.supply -= supply_state;
|
||||
|
||||
if supply_state.value > Sats::ZERO {
|
||||
@@ -64,7 +64,7 @@ impl CohortStateTrait for CohortState {
|
||||
}
|
||||
}
|
||||
|
||||
fn receive(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
pub fn receive(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.supply += supply_state;
|
||||
|
||||
if supply_state.value > Sats::ZERO {
|
||||
@@ -76,7 +76,7 @@ impl CohortStateTrait for CohortState {
|
||||
}
|
||||
}
|
||||
|
||||
fn send(
|
||||
pub fn send(
|
||||
&mut self,
|
||||
supply_state: &SupplyState,
|
||||
current_price: Option<Dollars>,
|
||||
@@ -104,7 +104,7 @@ impl CohortStateTrait for CohortState {
|
||||
}
|
||||
}
|
||||
|
||||
fn compute_unrealized_states(
|
||||
pub fn compute_unrealized_states(
|
||||
&self,
|
||||
height_price: Dollars,
|
||||
date_price: Option<Dollars>,
|
||||
@@ -166,7 +166,7 @@ impl CohortStateTrait for CohortState {
|
||||
(height_unrealized_state, date_unrealized_state)
|
||||
}
|
||||
|
||||
fn commit(&mut self, height: Height) -> Result<()> {
|
||||
pub fn commit(&mut self, height: Height) -> Result<()> {
|
||||
self.price_to_amount.flush(height)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
mod address;
|
||||
mod common;
|
||||
mod r#trait;
|
||||
// mod r#trait;
|
||||
mod utxo;
|
||||
|
||||
pub use address::*;
|
||||
pub use common::*;
|
||||
pub use r#trait::*;
|
||||
// pub use r#trait::*;
|
||||
pub use utxo::*;
|
||||
|
||||
@@ -3,70 +3,71 @@ use std::path::Path;
|
||||
use brk_core::{Dollars, Height, Result};
|
||||
use derive_deref::{Deref, DerefMut};
|
||||
|
||||
use crate::{CohortStateTrait, SupplyState, UnrealizedState};
|
||||
use crate::{SupplyState, UnrealizedState};
|
||||
|
||||
use super::CohortState;
|
||||
|
||||
#[derive(Clone, Deref, DerefMut)]
|
||||
pub struct UTXOCohortState(CohortState);
|
||||
|
||||
impl CohortStateTrait for UTXOCohortState {
|
||||
fn default_and_import(path: &Path, name: &str, compute_dollars: bool) -> Result<Self> {
|
||||
impl UTXOCohortState {
|
||||
pub fn default_and_import(path: &Path, name: &str, compute_dollars: bool) -> Result<Self> {
|
||||
Ok(Self(CohortState::default_and_import(
|
||||
path,
|
||||
name,
|
||||
compute_dollars,
|
||||
)?))
|
||||
}
|
||||
|
||||
fn reset_single_iteration_values(&mut self) {
|
||||
self.0.reset_single_iteration_values();
|
||||
}
|
||||
|
||||
fn increment(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.0.increment(supply_state, price);
|
||||
}
|
||||
|
||||
fn decrement(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.0.decrement(supply_state, price);
|
||||
}
|
||||
|
||||
fn decrement_price_to_amount(&mut self, supply_state: &SupplyState, price: Dollars) {
|
||||
self.0.decrement_price_to_amount(supply_state, price);
|
||||
}
|
||||
|
||||
fn receive(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
self.0.receive(supply_state, price);
|
||||
}
|
||||
|
||||
fn send(
|
||||
&mut self,
|
||||
supply_state: &SupplyState,
|
||||
current_price: Option<Dollars>,
|
||||
prev_price: Option<Dollars>,
|
||||
blocks_old: usize,
|
||||
days_old: f64,
|
||||
older_than_hour: bool,
|
||||
) {
|
||||
self.0.send(
|
||||
supply_state,
|
||||
current_price,
|
||||
prev_price,
|
||||
blocks_old,
|
||||
days_old,
|
||||
older_than_hour,
|
||||
);
|
||||
}
|
||||
|
||||
fn compute_unrealized_states(
|
||||
&self,
|
||||
height_price: Dollars,
|
||||
date_price: Option<Dollars>,
|
||||
) -> (UnrealizedState, Option<UnrealizedState>) {
|
||||
self.0.compute_unrealized_states(height_price, date_price)
|
||||
}
|
||||
|
||||
fn commit(&mut self, height: Height) -> Result<()> {
|
||||
self.0.commit(height)
|
||||
}
|
||||
}
|
||||
|
||||
// fn reset_single_iteration_values(&mut self) {
|
||||
// self.0.reset_single_iteration_values();
|
||||
// }
|
||||
|
||||
// fn increment(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
// self.0.increment(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn decrement(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
// self.0.decrement(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn decrement_price_to_amount(&mut self, supply_state: &SupplyState, price: Dollars) {
|
||||
// self.0.decrement_price_to_amount(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn receive(&mut self, supply_state: &SupplyState, price: Option<Dollars>) {
|
||||
// self.0.receive(supply_state, price);
|
||||
// }
|
||||
|
||||
// fn send(
|
||||
// &mut self,
|
||||
// supply_state: &SupplyState,
|
||||
// current_price: Option<Dollars>,
|
||||
// prev_price: Option<Dollars>,
|
||||
// blocks_old: usize,
|
||||
// days_old: f64,
|
||||
// older_than_hour: bool,
|
||||
// ) {
|
||||
// self.0.send(
|
||||
// supply_state,
|
||||
// current_price,
|
||||
// prev_price,
|
||||
// blocks_old,
|
||||
// days_old,
|
||||
// older_than_hour,
|
||||
// );
|
||||
// }
|
||||
|
||||
// fn compute_unrealized_states(
|
||||
// &self,
|
||||
// height_price: Dollars,
|
||||
// date_price: Option<Dollars>,
|
||||
// ) -> (UnrealizedState, Option<UnrealizedState>) {
|
||||
// self.0.compute_unrealized_states(height_price, date_price)
|
||||
// }
|
||||
|
||||
// fn commit(&mut self, height: Height) -> Result<()> {
|
||||
// self.0.commit(height)
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user