diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-03-07 16:21:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-07 16:21:40 +0800 |
commit | 72b21db2d31d77d956c09353457a0c2db45249b0 (patch) | |
tree | c0c750bfbbc5b5d8e9622847b676c1f4d99f4020 /internal | |
parent | f2d63103541ee3746ff0834e7c69d188af3572d2 (diff) | |
parent | 054412e33528e53f6deae940c870217b614707b9 (diff) | |
download | go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.gz go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.bz2 go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.lz go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.xz go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.tar.zst go-tangerine-72b21db2d31d77d956c09353457a0c2db45249b0.zip |
Merge pull request #19021 from karalabe/database-cleanup
all: clean up and properly abstract database accesses
Diffstat (limited to 'internal')
-rw-r--r-- | internal/ethapi/api.go | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 4d5ef27da..e85e6d20a 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -44,7 +44,6 @@ import ( "github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rpc" "github.com/syndtr/goleveldb/leveldb" - "github.com/syndtr/goleveldb/leveldb/util" ) const ( @@ -1556,16 +1555,9 @@ func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error) { } func (api *PrivateDebugAPI) ChaindbCompact() error { - ldb, ok := api.b.ChainDb().(interface { - LDB() *leveldb.DB - }) - if !ok { - return fmt.Errorf("chaindbCompact does not work for memory databases") - } for b := byte(0); b < 255; b++ { log.Info("Compacting chain database", "range", fmt.Sprintf("0x%0.2X-0x%0.2X", b, b+1)) - err := ldb.LDB().CompactRange(util.Range{Start: []byte{b}, Limit: []byte{b + 1}}) - if err != nil { + if err := api.b.ChainDb().Compact([]byte{b}, []byte{b + 1}); err != nil { log.Error("Database compaction failed", "err", err) return err } |