From a9c94cbf48fefe39104ee3495df139ff374dd219 Mon Sep 17 00:00:00 2001 From: Jeffrey Wilcke Date: Sat, 18 Jun 2016 11:17:57 +0200 Subject: [release/1.4.8] test, cmd/evm, core, core/vm: illegal code hash implementation This implements a generic approach to enabling soft forks by allowing anyone to put in hashes of contracts that should not be interacted from. This will help "The DAO" in their endevour to stop any whithdrawals from any DAO contract by convincing the mining community to accept their code hash. (cherry picked from commit 7a5b571c671e70e0e4807cf971c15e2d1e09d33d) --- core/state/statedb.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/state') diff --git a/core/state/statedb.go b/core/state/statedb.go index 3e25e0c16..79cbbaee8 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -51,6 +51,8 @@ type StateDB struct { txIndex int logs map[common.Hash]vm.Logs logSize uint + + reducedDao bool } // Create a new state from a given trie @@ -161,6 +163,14 @@ func (self *StateDB) GetCode(addr common.Address) []byte { return nil } +func (self *StateDB) GetCodeHash(addr common.Address) common.Hash { + stateObject := self.GetStateObject(addr) + if stateObject != nil { + return common.BytesToHash(stateObject.codeHash) + } + return common.Hash{} +} + func (self *StateDB) GetState(a common.Address, b common.Hash) common.Hash { stateObject := self.GetStateObject(a) if stateObject != nil { -- cgit v1.2.3