diff options
Diffstat (limited to 'core/state')
-rw-r--r-- | core/state/statedb.go | 21 | ||||
-rw-r--r-- | core/state/statedb_test.go | 4 |
2 files changed, 13 insertions, 12 deletions
diff --git a/core/state/statedb.go b/core/state/statedb.go index 82e2ec7c1..bbcde9443 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -24,6 +24,7 @@ import ( "sync" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" @@ -71,7 +72,7 @@ type StateDB struct { thash, bhash common.Hash txIndex int - logs map[common.Hash]vm.Logs + logs map[common.Hash][]*types.Log logSize uint // Journal of state modifications. This is the backbone of @@ -97,7 +98,7 @@ func New(root common.Hash, db ethdb.Database) (*StateDB, error) { stateObjects: make(map[common.Address]*StateObject), stateObjectsDirty: make(map[common.Address]struct{}), refund: new(big.Int), - logs: make(map[common.Hash]vm.Logs), + logs: make(map[common.Hash][]*types.Log), }, nil } @@ -118,7 +119,7 @@ func (self *StateDB) New(root common.Hash) (*StateDB, error) { stateObjects: make(map[common.Address]*StateObject), stateObjectsDirty: make(map[common.Address]struct{}), refund: new(big.Int), - logs: make(map[common.Hash]vm.Logs), + logs: make(map[common.Hash][]*types.Log), }, nil } @@ -138,7 +139,7 @@ func (self *StateDB) Reset(root common.Hash) error { self.thash = common.Hash{} self.bhash = common.Hash{} self.txIndex = 0 - self.logs = make(map[common.Hash]vm.Logs) + self.logs = make(map[common.Hash][]*types.Log) self.logSize = 0 self.clearJournalAndRefund() @@ -175,7 +176,7 @@ func (self *StateDB) StartRecord(thash, bhash common.Hash, ti int) { self.txIndex = ti } -func (self *StateDB) AddLog(log *vm.Log) { +func (self *StateDB) AddLog(log *types.Log) { self.journal = append(self.journal, addLogChange{txhash: self.thash}) log.TxHash = self.thash @@ -186,12 +187,12 @@ func (self *StateDB) AddLog(log *vm.Log) { self.logSize++ } -func (self *StateDB) GetLogs(hash common.Hash) vm.Logs { +func (self *StateDB) GetLogs(hash common.Hash) []*types.Log { return self.logs[hash] } -func (self *StateDB) Logs() vm.Logs { - var logs vm.Logs +func (self *StateDB) Logs() []*types.Log { + var logs []*types.Log for _, lgs := range self.logs { logs = append(logs, lgs...) } @@ -474,7 +475,7 @@ func (self *StateDB) Copy() *StateDB { stateObjects: make(map[common.Address]*StateObject, len(self.stateObjectsDirty)), stateObjectsDirty: make(map[common.Address]struct{}, len(self.stateObjectsDirty)), refund: new(big.Int).Set(self.refund), - logs: make(map[common.Hash]vm.Logs, len(self.logs)), + logs: make(map[common.Hash][]*types.Log, len(self.logs)), logSize: self.logSize, } // Copy the dirty states and logs @@ -483,7 +484,7 @@ func (self *StateDB) Copy() *StateDB { state.stateObjectsDirty[addr] = struct{}{} } for hash, logs := range self.logs { - state.logs[hash] = make(vm.Logs, len(logs)) + state.logs[hash] = make([]*types.Log, len(logs)) copy(state.logs[hash], logs) } return state diff --git a/core/state/statedb_test.go b/core/state/statedb_test.go index f91820378..874317300 100644 --- a/core/state/statedb_test.go +++ b/core/state/statedb_test.go @@ -29,7 +29,7 @@ import ( "testing/quick" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/vm" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" ) @@ -221,7 +221,7 @@ func newTestAction(addr common.Address, r *rand.Rand) testAction { fn: func(a testAction, s *StateDB) { data := make([]byte, 2) binary.BigEndian.PutUint16(data, uint16(a.args[0])) - s.AddLog(&vm.Log{Address: addr, Data: data}) + s.AddLog(&types.Log{Address: addr, Data: data}) }, args: make([]int64, 1), }, |