@@ -43,7 +43,7 @@ struct AccountCache {
43
43
modifications : VecDeque < BlockChanges > ,
44
44
}
45
45
46
- /// Pending account cache item.
46
+ /// Buffered account cache item.
47
47
struct CacheQueueItem {
48
48
/// Account address.
49
49
address : Address ,
@@ -80,8 +80,8 @@ pub struct StateDB {
80
80
db : Box < JournalDB > ,
81
81
/// Shared canonical state cache.
82
82
account_cache : Arc < Mutex < AccountCache > > ,
83
- /// Local pending cache changes .
84
- pending_cache : Vec < CacheQueueItem > ,
83
+ /// Local cache buffer .
84
+ cache_buffer : Vec < CacheQueueItem > ,
85
85
/// Shared account bloom. Does not handle chain reorganizations.
86
86
account_bloom : Arc < Mutex < Bloom > > ,
87
87
/// Hash of the block on top of which this instance was created or
@@ -130,7 +130,7 @@ impl StateDB {
130
130
accounts : LruCache :: new ( STATE_CACHE_ITEMS ) ,
131
131
modifications : VecDeque :: new ( ) ,
132
132
} ) ) ,
133
- pending_cache : Vec :: new ( ) ,
133
+ cache_buffer : Vec :: new ( ) ,
134
134
account_bloom : Arc :: new ( Mutex :: new ( bloom) ) ,
135
135
parent_hash : None ,
136
136
commit_hash : None ,
@@ -177,7 +177,7 @@ impl StateDB {
177
177
Ok ( records)
178
178
}
179
179
180
- /// Apply pending cache changes and synchronize canonical
180
+ /// Apply buffered cache changes and synchronize canonical
181
181
/// state cache with the best block state.
182
182
/// This function updates the cache by removing entries that are
183
183
/// invalidated by chain reorganization. `update_cache` should be
@@ -236,8 +236,8 @@ impl StateDB {
236
236
cache. modifications . pop_back ( ) ;
237
237
}
238
238
let mut modifications = HashSet :: new ( ) ;
239
- trace ! ( "committing {} cache entries" , self . pending_cache . len( ) ) ;
240
- for account in self . pending_cache . drain ( ..) {
239
+ trace ! ( "committing {} cache entries" , self . cache_buffer . len( ) ) ;
240
+ for account in self . cache_buffer . drain ( ..) {
241
241
if account. modified {
242
242
modifications. insert ( account. address . clone ( ) ) ;
243
243
}
@@ -287,7 +287,7 @@ impl StateDB {
287
287
StateDB {
288
288
db : self . db . boxed_clone ( ) ,
289
289
account_cache : self . account_cache . clone ( ) ,
290
- pending_cache : Vec :: new ( ) ,
290
+ cache_buffer : Vec :: new ( ) ,
291
291
account_bloom : self . account_bloom . clone ( ) ,
292
292
parent_hash : None ,
293
293
commit_hash : None ,
@@ -300,7 +300,7 @@ impl StateDB {
300
300
StateDB {
301
301
db : self . db . boxed_clone ( ) ,
302
302
account_cache : self . account_cache . clone ( ) ,
303
- pending_cache : Vec :: new ( ) ,
303
+ cache_buffer : Vec :: new ( ) ,
304
304
account_bloom : self . account_bloom . clone ( ) ,
305
305
parent_hash : Some ( parent. clone ( ) ) ,
306
306
commit_hash : None ,
@@ -326,7 +326,7 @@ impl StateDB {
326
326
/// Add pending cache change.
327
327
/// The change is queued to be applied in `commit`.
328
328
pub fn add_to_account_cache ( & mut self , addr : Address , data : Option < Account > , modified : bool ) {
329
- self . pending_cache . push ( CacheQueueItem {
329
+ self . cache_buffer . push ( CacheQueueItem {
330
330
address : addr,
331
331
account : data,
332
332
modified : modified,
0 commit comments