@@ -44,7 +44,6 @@ import (
44
44
"github.com/ethereum/go-ethereum/params"
45
45
"github.com/ethereum/go-ethereum/rlp"
46
46
"github.com/ethereum/go-ethereum/rpc"
47
- "github.com/syndtr/goleveldb/leveldb"
48
47
"github.com/tyler-smith/go-bip39"
49
48
)
50
49
@@ -1633,22 +1632,18 @@ func NewPrivateDebugAPI(b Backend) *PrivateDebugAPI {
1633
1632
return & PrivateDebugAPI {b : b }
1634
1633
}
1635
1634
1636
- // ChaindbProperty returns leveldb properties of the chain database.
1635
+ // ChaindbProperty returns leveldb properties of the key-value database.
1637
1636
func (api * PrivateDebugAPI ) ChaindbProperty (property string ) (string , error ) {
1638
- ldb , ok := api .b .ChainDb ().(interface {
1639
- LDB () * leveldb.DB
1640
- })
1641
- if ! ok {
1642
- return "" , fmt .Errorf ("chaindbProperty does not work for memory databases" )
1643
- }
1644
1637
if property == "" {
1645
1638
property = "leveldb.stats"
1646
1639
} else if ! strings .HasPrefix (property , "leveldb." ) {
1647
1640
property = "leveldb." + property
1648
1641
}
1649
- return ldb . LDB ().GetProperty (property )
1642
+ return api . b . ChainDb ().Stat (property )
1650
1643
}
1651
1644
1645
+ // ChaindbCompact flattens the entire key-value database into a single level,
1646
+ // removing all unused slots and merging all keys.
1652
1647
func (api * PrivateDebugAPI ) ChaindbCompact () error {
1653
1648
for b := byte (0 ); b < 255 ; b ++ {
1654
1649
log .Info ("Compacting chain database" , "range" , fmt .Sprintf ("0x%0.2X-0x%0.2X" , b , b + 1 ))
0 commit comments