@@ -14,7 +14,6 @@ import (
14
14
"testing"
15
15
"time"
16
16
17
- "github.com/prometheus/client_golang/prometheus"
18
17
"github.com/stretchr/testify/require"
19
18
20
19
"github.com/ava-labs/avalanchego/database"
@@ -27,8 +26,6 @@ import (
27
26
"github.com/ava-labs/avalanchego/utils/units"
28
27
)
29
28
30
- const defaultHistoryLength = 300
31
-
32
29
// newDB returns a new merkle database with the underlying type so that tests can access unexported fields
33
30
func newDB (ctx context.Context , db database.Database , config Config ) (* merkleDB , error ) {
34
31
db , err := New (ctx , db , config )
@@ -38,14 +35,6 @@ func newDB(ctx context.Context, db database.Database, config Config) (*merkleDB,
38
35
return db .(* merkleDB ), nil
39
36
}
40
37
41
- func newDefaultConfig () Config {
42
- config := NewConfig ()
43
- config .HistoryLength = defaultHistoryLength
44
- config .Reg = prometheus .NewRegistry ()
45
-
46
- return config
47
- }
48
-
49
38
func Test_MerkleDB_Get_Safety (t * testing.T ) {
50
39
require := require .New (t )
51
40
@@ -125,7 +114,7 @@ func Test_MerkleDB_DB_Load_Root_From_DB(t *testing.T) {
125
114
db , err := New (
126
115
context .Background (),
127
116
baseDB ,
128
- newDefaultConfig (),
117
+ NewConfig (),
129
118
)
130
119
require .NoError (err )
131
120
@@ -153,7 +142,7 @@ func Test_MerkleDB_DB_Load_Root_From_DB(t *testing.T) {
153
142
db , err = New (
154
143
context .Background (),
155
144
baseDB ,
156
- newDefaultConfig (),
145
+ NewConfig (),
157
146
)
158
147
require .NoError (err )
159
148
@@ -167,7 +156,7 @@ func Test_MerkleDB_DB_Rebuild(t *testing.T) {
167
156
168
157
initialSize := 5_000
169
158
170
- config := newDefaultConfig ()
159
+ config := NewConfig ()
171
160
config .ValueNodeCacheSize = uint (initialSize )
172
161
config .IntermediateNodeCacheSize = uint (initialSize )
173
162
@@ -224,7 +213,7 @@ func Test_MerkleDB_Failed_Batch_Commit(t *testing.T) {
224
213
db , err := New (
225
214
context .Background (),
226
215
memDB ,
227
- newDefaultConfig (),
216
+ NewConfig (),
228
217
)
229
218
require .NoError (err )
230
219
@@ -245,7 +234,7 @@ func Test_MerkleDB_Value_Cache(t *testing.T) {
245
234
db , err := New (
246
235
context .Background (),
247
236
memDB ,
248
- newDefaultConfig (),
237
+ NewConfig (),
249
238
)
250
239
require .NoError (err )
251
240
@@ -1292,7 +1281,7 @@ func TestCrashRecovery(t *testing.T) {
1292
1281
merkleDB , err := newDatabase (
1293
1282
context .Background (),
1294
1283
baseDB ,
1295
- newDefaultConfig (),
1284
+ NewConfig (),
1296
1285
& mockMetrics {},
1297
1286
)
1298
1287
require .NoError (err )
@@ -1310,7 +1299,7 @@ func TestCrashRecovery(t *testing.T) {
1310
1299
newMerkleDB , err := newDatabase (
1311
1300
context .Background (),
1312
1301
baseDB ,
1313
- newDefaultConfig (),
1302
+ NewConfig (),
1314
1303
& mockMetrics {},
1315
1304
)
1316
1305
require .NoError (err )
0 commit comments