@@ -19,7 +19,7 @@ pub type InMemoryDB = CacheDB<EmptyDB>;
19
19
/// The [DbAccount] holds the code hash of the contract, which is used to look up the contract in the `contracts` map.
20
20
#[ derive( Debug , Clone ) ]
21
21
#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
22
- pub struct CacheDB < ExtDB : DatabaseRef > {
22
+ pub struct CacheDB < ExtDB > {
23
23
/// Account info where None means it is not existing. Not existing state is needed for Pre TANGERINE forks.
24
24
/// `code` is always `None`, and bytecode can be found in `contracts`.
25
25
pub accounts : HashMap < Address , DbAccount > ,
@@ -35,13 +35,13 @@ pub struct CacheDB<ExtDB: DatabaseRef> {
35
35
pub db : ExtDB ,
36
36
}
37
37
38
- impl < ExtDB : DatabaseRef + Default > Default for CacheDB < ExtDB > {
38
+ impl < ExtDB : Default > Default for CacheDB < ExtDB > {
39
39
fn default ( ) -> Self {
40
40
Self :: new ( ExtDB :: default ( ) )
41
41
}
42
42
}
43
43
44
- impl < ExtDB : DatabaseRef > CacheDB < ExtDB > {
44
+ impl < ExtDB > CacheDB < ExtDB > {
45
45
pub fn new ( db : ExtDB ) -> Self {
46
46
let mut contracts = HashMap :: new ( ) ;
47
47
contracts. insert ( KECCAK_EMPTY , Bytecode :: new ( ) ) ;
@@ -81,7 +81,9 @@ impl<ExtDB: DatabaseRef> CacheDB<ExtDB> {
81
81
self . insert_contract ( & mut info) ;
82
82
self . accounts . entry ( address) . or_default ( ) . info = info;
83
83
}
84
+ }
84
85
86
+ impl < ExtDB : DatabaseRef > CacheDB < ExtDB > {
85
87
/// Returns the account for the given address.
86
88
///
87
89
/// If the account was not found in the cache, it will be loaded from the underlying database.
@@ -125,7 +127,7 @@ impl<ExtDB: DatabaseRef> CacheDB<ExtDB> {
125
127
}
126
128
}
127
129
128
- impl < ExtDB : DatabaseRef > DatabaseCommit for CacheDB < ExtDB > {
130
+ impl < ExtDB > DatabaseCommit for CacheDB < ExtDB > {
129
131
fn commit ( & mut self , changes : HashMap < Address , Account > ) {
130
132
for ( address, mut account) in changes {
131
133
if !account. is_touched ( ) {
0 commit comments