@@ -17,7 +17,7 @@ use cuprate_types::{
17
17
Chain ,
18
18
} ;
19
19
20
- use crate :: { Database , ExtendedConsensusError , HardFork } ;
20
+ use crate :: { Database , ContextCacheError , HardFork } ;
21
21
22
22
/// The amount of blocks we account for to calculate difficulty
23
23
const DIFFICULTY_WINDOW : usize = 720 ;
@@ -33,9 +33,9 @@ const DIFFICULTY_LAG: usize = 15;
33
33
///
34
34
#[ derive( Debug , Clone , Copy , Eq , PartialEq ) ]
35
35
pub struct DifficultyCacheConfig {
36
- pub ( crate ) window : usize ,
37
- pub ( crate ) cut : usize ,
38
- pub ( crate ) lag : usize ,
36
+ pub window : usize ,
37
+ pub cut : usize ,
38
+ pub lag : usize ,
39
39
}
40
40
41
41
impl DifficultyCacheConfig {
@@ -74,13 +74,13 @@ impl DifficultyCacheConfig {
74
74
pub struct DifficultyCache {
75
75
/// The list of timestamps in the window.
76
76
/// len <= [`DIFFICULTY_BLOCKS_COUNT`]
77
- pub ( crate ) timestamps : VecDeque < u64 > ,
77
+ pub timestamps : VecDeque < u64 > ,
78
78
/// The current cumulative difficulty of the chain.
79
- pub ( crate ) cumulative_difficulties : VecDeque < u128 > ,
79
+ pub cumulative_difficulties : VecDeque < u128 > ,
80
80
/// The last height we accounted for.
81
- pub ( crate ) last_accounted_height : usize ,
81
+ pub last_accounted_height : usize ,
82
82
/// The config
83
- pub ( crate ) config : DifficultyCacheConfig ,
83
+ pub config : DifficultyCacheConfig ,
84
84
}
85
85
86
86
impl DifficultyCache {
@@ -91,7 +91,7 @@ impl DifficultyCache {
91
91
config : DifficultyCacheConfig ,
92
92
database : D ,
93
93
chain : Chain ,
94
- ) -> Result < Self , ExtendedConsensusError > {
94
+ ) -> Result < Self , ContextCacheError > {
95
95
tracing:: info!( "Initializing difficulty cache this may take a while." ) ;
96
96
97
97
let mut block_start = chain_height. saturating_sub ( config. total_block_count ( ) ) ;
@@ -134,7 +134,7 @@ impl DifficultyCache {
134
134
& mut self ,
135
135
numb_blocks : usize ,
136
136
database : D ,
137
- ) -> Result < ( ) , ExtendedConsensusError > {
137
+ ) -> Result < ( ) , ContextCacheError > {
138
138
let Some ( retained_blocks) = self . timestamps . len ( ) . checked_sub ( numb_blocks) else {
139
139
// More blocks to pop than we have in the cache, so just restart a new cache.
140
140
* self = Self :: init_from_chain_height (
@@ -361,7 +361,7 @@ async fn get_blocks_in_pow_info<D: Database + Clone>(
361
361
database : D ,
362
362
block_heights : Range < usize > ,
363
363
chain : Chain ,
364
- ) -> Result < ( VecDeque < u64 > , VecDeque < u128 > ) , ExtendedConsensusError > {
364
+ ) -> Result < ( VecDeque < u64 > , VecDeque < u128 > ) , ContextCacheError > {
365
365
tracing:: info!( "Getting blocks timestamps" ) ;
366
366
367
367
let BlockchainResponse :: BlockExtendedHeaderInRange ( ext_header) = database
0 commit comments