aboutsummaryrefslogtreecommitdiffstats
path: root/core/state
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-09-14 15:35:57 +0800
committerFelix Lange <fjl@twurst.com>2015-09-15 05:36:30 +0800
commit8c4dab77ba48dc68073fe1df79e7000043c0f966 (patch)
tree09ebb0fdb1b72e49ea2cfb9ebdc55a73a174302a /core/state
parent55ed8d108d72d12543ecdc6d8c9d9978392dabf0 (diff)
downloaddexon-8c4dab77ba48dc68073fe1df79e7000043c0f966.tar.gz
dexon-8c4dab77ba48dc68073fe1df79e7000043c0f966.tar.zst
dexon-8c4dab77ba48dc68073fe1df79e7000043c0f966.zip
all: move common.Database to package ethdb
Diffstat (limited to 'core/state')
-rw-r--r--core/state/state_object.go7
-rw-r--r--core/state/statedb.go5
2 files changed, 7 insertions, 5 deletions
diff --git a/core/state/state_object.go b/core/state/state_object.go
index 69c64ae40..353f2357b 100644
--- a/core/state/state_object.go
+++ b/core/state/state_object.go
@@ -23,6 +23,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
+ "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/rlp"
@@ -56,7 +57,7 @@ func (self Storage) Copy() Storage {
type StateObject struct {
// State database for storing state changes
- db common.Database
+ db ethdb.Database
trie *trie.SecureTrie
// Address belonging to this account
@@ -87,7 +88,7 @@ type StateObject struct {
dirty bool
}
-func NewStateObject(address common.Address, db common.Database) *StateObject {
+func NewStateObject(address common.Address, db ethdb.Database) *StateObject {
object := &StateObject{db: db, address: address, balance: new(big.Int), gasPool: new(big.Int), dirty: true}
object.trie = trie.NewSecure((common.Hash{}).Bytes(), db)
object.storage = make(Storage)
@@ -96,7 +97,7 @@ func NewStateObject(address common.Address, db common.Database) *StateObject {
return object
}
-func NewStateObjectFromBytes(address common.Address, data []byte, db common.Database) *StateObject {
+func NewStateObjectFromBytes(address common.Address, data []byte, db ethdb.Database) *StateObject {
// TODO clean me up
var extobject struct {
Nonce uint64
diff --git a/core/state/statedb.go b/core/state/statedb.go
index b754f0887..24f97e32a 100644
--- a/core/state/statedb.go
+++ b/core/state/statedb.go
@@ -21,6 +21,7 @@ import (
"math/big"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/trie"
@@ -32,7 +33,7 @@ import (
// * Contracts
// * Accounts
type StateDB struct {
- db common.Database
+ db ethdb.Database
trie *trie.SecureTrie
root common.Hash
@@ -47,7 +48,7 @@ type StateDB struct {
}
// Create a new state from a given trie
-func New(root common.Hash, db common.Database) *StateDB {
+func New(root common.Hash, db ethdb.Database) *StateDB {
trie := trie.NewSecure(root[:], db)
return &StateDB{root: root, db: db, trie: trie, stateObjects: make(map[string]*StateObject), refund: new(big.Int), logs: make(map[common.Hash]Logs)}
}