mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-11 22:51:16 -07:00
computer: perf
This commit is contained in:
@@ -1340,33 +1340,36 @@ impl Vecs {
|
|||||||
|
|
||||||
let prev_timestamp = chain_state.last().unwrap().timestamp;
|
let prev_timestamp = chain_state.last().unwrap().timestamp;
|
||||||
|
|
||||||
self.age_range
|
let mut vecs = self
|
||||||
|
.age_range
|
||||||
.as_mut_vec()
|
.as_mut_vec()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(filter, v)| (filter, &mut v.state))
|
.map(|(filter, v)| (filter, &mut v.state))
|
||||||
.for_each(|(filter, state)| {
|
.collect::<Vec<_>>();
|
||||||
let _ = chain_state
|
|
||||||
.iter()
|
|
||||||
.try_for_each(|block_state| -> ControlFlow<()> {
|
|
||||||
let prev_days_old =
|
|
||||||
prev_timestamp.difference_in_days_between(block_state.timestamp);
|
|
||||||
let days_old = timestamp.difference_in_days_between(block_state.timestamp);
|
|
||||||
|
|
||||||
if prev_days_old == days_old {
|
let _ = chain_state
|
||||||
return ControlFlow::Continue(());
|
.iter()
|
||||||
}
|
.try_for_each(|block_state| -> ControlFlow<()> {
|
||||||
|
let prev_days_old =
|
||||||
|
prev_timestamp.difference_in_days_between(block_state.timestamp);
|
||||||
|
let days_old = timestamp.difference_in_days_between(block_state.timestamp);
|
||||||
|
|
||||||
let is = filter.contains(days_old);
|
if prev_days_old == days_old {
|
||||||
let was = filter.contains(prev_days_old);
|
return ControlFlow::Continue(());
|
||||||
|
}
|
||||||
|
|
||||||
if is && !was {
|
vecs.iter_mut().for_each(|(filter, state)| {
|
||||||
state.increment(&block_state.supply, block_state.price);
|
let is = filter.contains(days_old);
|
||||||
} else if was && !is {
|
let was = filter.contains(prev_days_old);
|
||||||
state.decrement(&block_state.supply, block_state.price);
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlFlow::Continue(())
|
if is && !was {
|
||||||
});
|
state.increment(&block_state.supply, block_state.price);
|
||||||
|
} else if was && !is {
|
||||||
|
state.decrement(&block_state.supply, block_state.price);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ControlFlow::Continue(())
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user