aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm_env.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2016-06-22 16:59:28 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-06-24 18:18:28 +0800
commitf31a3a251afad1d4c7169bc530fe60471df36122 (patch)
tree0e776d948929b34a731277598a516c20d4d255b1 /core/vm_env.go
parenta9c94cbf48fefe39104ee3495df139ff374dd219 (diff)
downloadgo-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.tar
go-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.tar.gz
go-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.tar.bz2
go-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.tar.lz
go-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.tar.xz
go-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.tar.zst
go-tangerine-f31a3a251afad1d4c7169bc530fe60471df36122.zip
[release/1.4.8] core: add voting and result tracking for the dao soft-fork
(cherry picked from commit c4de28938ff8c688c4444c8b3e8e28a52cbc62ff)
Diffstat (limited to 'core/vm_env.go')
-rw-r--r--core/vm_env.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/vm_env.go b/core/vm_env.go
index 3ef61b8ce..a485bfd03 100644
--- a/core/vm_env.go
+++ b/core/vm_env.go
@@ -25,7 +25,9 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
)
-var IllegalCodeHashes map[common.Hash]struct{}
+// BlockedCodeHashes is a set of EVM code hashes that this node should block
+// sending funds from.
+var BlockedCodeHashes map[common.Hash]struct{}
// GetHashFn returns a function for which the VM env can query block hashes through
// up to the limit defined by the Yellow Paper and uses the given block chain
@@ -49,7 +51,7 @@ type VMEnv struct {
depth int // Current execution depth
msg Message // Message appliod
- CodeHashes []common.Hash // code hashes collected during execution
+ codeHashes map[common.Hash]struct{} // code hashes collected during execution
header *types.Header // Header information
chain *BlockChain // Blockchain handle
@@ -60,6 +62,7 @@ type VMEnv struct {
func NewEnv(state *state.StateDB, chainConfig *ChainConfig, chain *BlockChain, msg Message, header *types.Header, cfg vm.Config) *VMEnv {
env := &VMEnv{
chainConfig: chainConfig,
+ codeHashes: make(map[common.Hash]struct{}),
chain: chain,
state: state,
header: header,
@@ -76,7 +79,8 @@ func NewEnv(state *state.StateDB, chainConfig *ChainConfig, chain *BlockChain, m
return env
}
-func (self *VMEnv) MarkCodeHash(hash common.Hash) { self.CodeHashes = append(self.CodeHashes, hash) }
+func (self *VMEnv) MarkCodeHash(hash common.Hash) { self.codeHashes[hash] = struct{}{} }
+func (self *VMEnv) GetMarkedCodeHashes() map[common.Hash]struct{} { return self.codeHashes }
func (self *VMEnv) RuleSet() vm.RuleSet { return self.chainConfig }
func (self *VMEnv) Vm() vm.Vm { return self.evm }