aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-02-20 21:36:34 +0800
committerFelix Lange <fjl@twurst.com>2016-04-13 18:08:07 +0800
commitbcd8aeefdd40174a7fb1dd320b00f090d8986f11 (patch)
treeee473034881b67166405b2c91f08b43d92788837 /eth
parent05e257c22cbdbf689634927557bcab05f2befad0 (diff)
downloaddexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.tar
dexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.tar.gz
dexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.tar.bz2
dexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.tar.lz
dexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.tar.xz
dexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.tar.zst
dexon-bcd8aeefdd40174a7fb1dd320b00f090d8986f11.zip
eth: add chaindbProperty to debug API
Diffstat (limited to 'eth')
-rw-r--r--eth/api.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/eth/api.go b/eth/api.go
index 508070646..105886752 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -26,6 +26,7 @@ import (
"math/big"
"os"
"runtime"
+ "strings"
"sync"
"time"
@@ -46,6 +47,7 @@ import (
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
+ "github.com/syndtr/goleveldb/leveldb"
"golang.org/x/net/context"
)
@@ -1566,6 +1568,22 @@ func NewPrivateDebugAPI(config *core.ChainConfig, eth *Ethereum) *PrivateDebugAP
return &PrivateDebugAPI{config: config, eth: eth}
}
+// ChaindbProperty returns leveldb properties of the chain database.
+func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error) {
+ ldb, ok := api.eth.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)
+}
+
// BlockTraceResults is the returned value when replaying a block to check for
// consensus results and full VM trace logs for all included transactions.
type BlockTraceResult struct {