@@ -19,7 +19,7 @@ pub type InMemoryDB = CacheDB<EmptyDB>;
1919/// The [DbAccount] holds the code hash of the contract, which is used to look up the contract in the `contracts` map.
2020#[ derive( Debug , Clone ) ]
2121#[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
22- pub struct CacheDB < ExtDB : DatabaseRef > {
22+ pub struct CacheDB < ExtDB > {
2323 /// Account info where None means it is not existing. Not existing state is needed for Pre TANGERINE forks.
2424 /// `code` is always `None`, and bytecode can be found in `contracts`.
2525 pub accounts : HashMap < Address , DbAccount > ,
@@ -35,13 +35,13 @@ pub struct CacheDB<ExtDB: DatabaseRef> {
3535 pub db : ExtDB ,
3636}
3737
38- impl < ExtDB : DatabaseRef + Default > Default for CacheDB < ExtDB > {
38+ impl < ExtDB : Default > Default for CacheDB < ExtDB > {
3939 fn default ( ) -> Self {
4040 Self :: new ( ExtDB :: default ( ) )
4141 }
4242}
4343
44- impl < ExtDB : DatabaseRef > CacheDB < ExtDB > {
44+ impl < ExtDB > CacheDB < ExtDB > {
4545 pub fn new ( db : ExtDB ) -> Self {
4646 let mut contracts = HashMap :: new ( ) ;
4747 contracts. insert ( KECCAK_EMPTY , Bytecode :: new ( ) ) ;
@@ -81,7 +81,9 @@ impl<ExtDB: DatabaseRef> CacheDB<ExtDB> {
8181 self . insert_contract ( & mut info) ;
8282 self . accounts . entry ( address) . or_default ( ) . info = info;
8383 }
84+ }
8485
86+ impl < ExtDB : DatabaseRef > CacheDB < ExtDB > {
8587 /// Returns the account for the given address.
8688 ///
8789 /// 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> {
125127 }
126128}
127129
128- impl < ExtDB : DatabaseRef > DatabaseCommit for CacheDB < ExtDB > {
130+ impl < ExtDB > DatabaseCommit for CacheDB < ExtDB > {
129131 fn commit ( & mut self , changes : HashMap < Address , Account > ) {
130132 for ( address, mut account) in changes {
131133 if !account. is_touched ( ) {
0 commit comments