aboutsummaryrefslogtreecommitdiffstats
path: root/ethdb
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-12-21 19:56:11 +0800
committerGitHub <noreply@github.com>2017-12-21 19:56:11 +0800
commit5258785c81959109138ebeca613f12c277188abc (patch)
treeb3d21fc2f38927841f44541a3717b69f5a3c5ec1 /ethdb
parent1a5425779b026587e36f5d21a6e50efe17cc6a9d (diff)
downloaddexon-5258785c81959109138ebeca613f12c277188abc.tar
dexon-5258785c81959109138ebeca613f12c277188abc.tar.gz
dexon-5258785c81959109138ebeca613f12c277188abc.tar.bz2
dexon-5258785c81959109138ebeca613f12c277188abc.tar.lz
dexon-5258785c81959109138ebeca613f12c277188abc.tar.xz
dexon-5258785c81959109138ebeca613f12c277188abc.tar.zst
dexon-5258785c81959109138ebeca613f12c277188abc.zip
cmd, core, eth/tracers: support fancier js tracing (#15516)
* cmd, core, eth/tracers: support fancier js tracing * eth, internal/web3ext: rework trace API, concurrency, chain tracing * eth/tracers: add three more JavaScript tracers * eth/tracers, vendor: swap ottovm to duktape for tracing * core, eth, internal: finalize call tracer and needed extras * eth, tests: prestate tracer, call test suite, rewinding * vendor: fix windows builds for tracer js engine * vendor: temporary duktape fix * eth/tracers: fix up 4byte and evmdis tracer * vendor: pull in latest duktape with my upstream fixes * eth: fix some review comments * eth: rename rewind to reexec to make it more obvious * core/vm: terminate tracing using defers
Diffstat (limited to 'ethdb')
-rw-r--r--ethdb/memory_database.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/ethdb/memory_database.go b/ethdb/memory_database.go
index 699bd0c9f..0dd93a279 100644
--- a/ethdb/memory_database.go
+++ b/ethdb/memory_database.go
@@ -37,6 +37,12 @@ func NewMemDatabase() (*MemDatabase, error) {
}, nil
}
+func NewMemDatabaseWithCap(size int) (*MemDatabase, error) {
+ return &MemDatabase{
+ db: make(map[string][]byte, size),
+ }, nil
+}
+
func (db *MemDatabase) Put(key []byte, value []byte) error {
db.lock.Lock()
defer db.lock.Unlock()
@@ -74,14 +80,6 @@ func (db *MemDatabase) Keys() [][]byte {
return keys
}
-/*
-func (db *MemDatabase) GetKeys() []*common.Key {
- data, _ := db.Get([]byte("KeyRing"))
-
- return []*common.Key{common.NewKeyFromBytes(data)}
-}
-*/
-
func (db *MemDatabase) Delete(key []byte) error {
db.lock.Lock()
defer db.lock.Unlock()
@@ -96,6 +94,8 @@ func (db *MemDatabase) NewBatch() Batch {
return &memBatch{db: db}
}
+func (db *MemDatabase) Len() int { return len(db.db) }
+
type kv struct{ k, v []byte }
type memBatch struct {