@@ -62,6 +62,7 @@ Remove blockchain and state databases`,
62
62
dbPutCmd ,
63
63
dbGetSlotsCmd ,
64
64
dbDumpFreezerIndex ,
65
+ ancientInspectCmd ,
65
66
},
66
67
}
67
68
dbInspectCmd = cli.Command {
@@ -195,6 +196,16 @@ WARNING: This is a low-level operation which may cause database corruption!`,
195
196
},
196
197
Description : "This command displays information about the freezer index." ,
197
198
}
199
+ ancientInspectCmd = cli.Command {
200
+ Action : utils .MigrateFlags (ancientInspect ),
201
+ Name : "inspect-reserved-oldest-blocks" ,
202
+ Flags : []cli.Flag {
203
+ utils .DataDirFlag ,
204
+ },
205
+ Usage : "Inspect the ancientStore information" ,
206
+ Description : `This commands will read current offset from kvdb, which is the current offset and starting BlockNumber
207
+ of ancientStore, will also displays the reserved number of blocks in ancientStore ` ,
208
+ }
198
209
)
199
210
200
211
func removeDB (ctx * cli.Context ) error {
@@ -282,12 +293,21 @@ func inspect(ctx *cli.Context) error {
282
293
stack , _ := makeConfigNode (ctx )
283
294
defer stack .Close ()
284
295
285
- db := utils .MakeChainDatabase (ctx , stack , true )
296
+ db := utils .MakeChainDatabase (ctx , stack , true , false )
286
297
defer db .Close ()
287
298
288
299
return rawdb .InspectDatabase (db , prefix , start )
289
300
}
290
301
302
+ func ancientInspect (ctx * cli.Context ) error {
303
+ stack , _ := makeConfigNode (ctx )
304
+ defer stack .Close ()
305
+
306
+ db := utils .MakeChainDatabase (ctx , stack , true , true )
307
+ defer db .Close ()
308
+ return rawdb .AncientInspect (db )
309
+ }
310
+
291
311
func showLeveldbStats (db ethdb.Stater ) {
292
312
if stats , err := db .Stat ("leveldb.stats" ); err != nil {
293
313
log .Warn ("Failed to read database stats" , "error" , err )
@@ -305,7 +325,7 @@ func dbStats(ctx *cli.Context) error {
305
325
stack , _ := makeConfigNode (ctx )
306
326
defer stack .Close ()
307
327
308
- db := utils .MakeChainDatabase (ctx , stack , true )
328
+ db := utils .MakeChainDatabase (ctx , stack , true , false )
309
329
defer db .Close ()
310
330
311
331
showLeveldbStats (db )
@@ -316,7 +336,7 @@ func dbCompact(ctx *cli.Context) error {
316
336
stack , _ := makeConfigNode (ctx )
317
337
defer stack .Close ()
318
338
319
- db := utils .MakeChainDatabase (ctx , stack , false )
339
+ db := utils .MakeChainDatabase (ctx , stack , false , false )
320
340
defer db .Close ()
321
341
322
342
log .Info ("Stats before compaction" )
@@ -340,7 +360,7 @@ func dbGet(ctx *cli.Context) error {
340
360
stack , _ := makeConfigNode (ctx )
341
361
defer stack .Close ()
342
362
343
- db := utils .MakeChainDatabase (ctx , stack , true )
363
+ db := utils .MakeChainDatabase (ctx , stack , true , false )
344
364
defer db .Close ()
345
365
346
366
key , err := hexutil .Decode (ctx .Args ().Get (0 ))
@@ -365,7 +385,7 @@ func dbDelete(ctx *cli.Context) error {
365
385
stack , _ := makeConfigNode (ctx )
366
386
defer stack .Close ()
367
387
368
- db := utils .MakeChainDatabase (ctx , stack , false )
388
+ db := utils .MakeChainDatabase (ctx , stack , false , false )
369
389
defer db .Close ()
370
390
371
391
key , err := hexutil .Decode (ctx .Args ().Get (0 ))
@@ -392,7 +412,7 @@ func dbPut(ctx *cli.Context) error {
392
412
stack , _ := makeConfigNode (ctx )
393
413
defer stack .Close ()
394
414
395
- db := utils .MakeChainDatabase (ctx , stack , false )
415
+ db := utils .MakeChainDatabase (ctx , stack , false , false )
396
416
defer db .Close ()
397
417
398
418
var (
@@ -426,7 +446,7 @@ func dbDumpTrie(ctx *cli.Context) error {
426
446
stack , _ := makeConfigNode (ctx )
427
447
defer stack .Close ()
428
448
429
- db := utils .MakeChainDatabase (ctx , stack , true )
449
+ db := utils .MakeChainDatabase (ctx , stack , true , false )
430
450
defer db .Close ()
431
451
var (
432
452
root []byte
0 commit comments