@@ -55,11 +55,7 @@ func NewDatabase(db ethdb.Database) ethstate.Database {
5555}
5656
5757func NewDatabaseWithConfig (db ethdb.Database , config * triedb.Config ) ethstate.Database {
58- if config == nil {
59- return NewDatabase (db )
60- }
61-
62- if config .DBOverride == nil {
58+ if config == nil || config .DBOverride == nil {
6359 return ethstate .NewDatabaseWithConfig (db , config )
6460 }
6561
@@ -73,7 +69,6 @@ func NewDatabaseWithConfig(db ethdb.Database, config *triedb.Config) ethstate.Da
7369 return ethstate .NewDatabaseWithConfig (db , config )
7470 }
7571 if innerdb == nil {
76- fmt .Printf ("firewood is nil" )
7772 log .Error ("firewooddb.Database is nil" )
7873 return nil
7974 }
@@ -88,28 +83,6 @@ func NewDatabaseWithNodeDB(db ethdb.Database, triedb *triedb.Database) ethstate.
8883 return ethstate .NewDatabaseWithNodeDB (db , triedb )
8984}
9085
91- // Note trieConfig provides a closure here.
92- func NewDatabaseWithFirewood (db ethdb.Database , trieConfig * triedb.Config ) Database {
93- // I could create my own Config, create the config, and create the triedb.Config
94- // Don't accept the triedb and create it here
95- fw , ok := trieConfig .DBOverride (db ).(* firewood.Database )
96- if ! ok {
97- log .Error ("Cannot create firewooddb.Database from the provided database" )
98- fmt .Printf ("not ok" )
99- return nil
100- }
101- if fw == nil {
102- fmt .Printf ("firewood is nil" )
103- log .Error ("firewooddb.Database is nil" )
104- return nil
105- }
106-
107- return & firewoodAccessorDb {
108- Database : ethstate .NewDatabaseWithConfig (db , trieConfig ),
109- fw : fw ,
110- }
111- }
112-
11386type firewoodAccessorDb struct {
11487 Database
11588 fw * firewood.Database
@@ -132,5 +105,4 @@ func (db *firewoodAccessorDb) OpenStorageTrie(stateRoot common.Hash, address com
132105// CopyTrie returns an independent copy of the given trie.
133106func (db * firewoodAccessorDb ) CopyTrie (trie Trie ) Trie {
134107 panic ("CopyTrie not implemented for firewoodAccessorDb" )
135- return nil
136108}
0 commit comments