Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
433cb564
Unverified
Commit
433cb564
authored
5 years ago
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal/ethapi: fix debug.chaindbProperty
parent
8485f7cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
api.go
internal/ethapi/api.go
+4
-9
No files found.
internal/ethapi/api.go
View file @
433cb564
...
...
@@ -44,7 +44,6 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/syndtr/goleveldb/leveldb"
"github.com/tyler-smith/go-bip39"
)
...
...
@@ -1633,22 +1632,18 @@ func NewPrivateDebugAPI(b Backend) *PrivateDebugAPI {
return
&
PrivateDebugAPI
{
b
:
b
}
}
// ChaindbProperty returns leveldb properties of the
chain
database.
// ChaindbProperty returns leveldb properties of the
key-value
database.
func
(
api
*
PrivateDebugAPI
)
ChaindbProperty
(
property
string
)
(
string
,
error
)
{
ldb
,
ok
:=
api
.
b
.
ChainDb
()
.
(
interface
{
LDB
()
*
leveldb
.
DB
})
if
!
ok
{
return
""
,
fmt
.
Errorf
(
"chaindbProperty does not work for memory databases"
)
}
if
property
==
""
{
property
=
"leveldb.stats"
}
else
if
!
strings
.
HasPrefix
(
property
,
"leveldb."
)
{
property
=
"leveldb."
+
property
}
return
ldb
.
LDB
()
.
GetProperty
(
property
)
return
api
.
b
.
ChainDb
()
.
Stat
(
property
)
}
// ChaindbCompact flattens the entire key-value database into a single level,
// removing all unused slots and merging all keys.
func
(
api
*
PrivateDebugAPI
)
ChaindbCompact
()
error
{
for
b
:=
byte
(
0
);
b
<
255
;
b
++
{
log
.
Info
(
"Compacting chain database"
,
"range"
,
fmt
.
Sprintf
(
"0x%0.2X-0x%0.2X"
,
b
,
b
+
1
))
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment