aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/evm/main.go1
-rw-r--r--cmd/utils/flags.go16
2 files changed, 17 insertions, 0 deletions
diff --git a/cmd/evm/main.go b/cmd/evm/main.go
index aa48f6ede..ba7d8d8a8 100644
--- a/cmd/evm/main.go
+++ b/cmd/evm/main.go
@@ -220,6 +220,7 @@ type ruleSet struct{}
func (ruleSet) IsHomestead(*big.Int) bool { return true }
+func (self *VMEnv) MarkCodeHash(common.Hash) {}
func (self *VMEnv) RuleSet() vm.RuleSet { return ruleSet{} }
func (self *VMEnv) Vm() vm.Vm { return self.evm }
func (self *VMEnv) Db() vm.Database { return self.state }
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 14898b987..802e54c73 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -163,6 +163,10 @@ var (
}
// Miner settings
// TODO: refactor CPU vs GPU mining flags
+ IllegalCodeHashesFlag = cli.StringFlag{
+ Name: "illegal-code-hashes",
+ Usage: "Comma separated list of code-hashes to ignore any interaction from",
+ }
MiningEnabledFlag = cli.BoolFlag{
Name: "mine",
Usage: "Enable mining",
@@ -640,6 +644,16 @@ func MakePasswordList(ctx *cli.Context) []string {
return lines
}
+// ParseIllegalCodeHashes parses a comma separated list of hashes.
+func ParseIllegalCodeHashes(ctx *cli.Context) map[common.Hash]struct{} {
+ splittedHexHashes := strings.Split(ctx.GlobalString(IllegalCodeHashesFlag.Name), ",")
+ illegalCodeHashes := make(map[common.Hash]struct{})
+ for _, hexHash := range splittedHexHashes {
+ illegalCodeHashes[common.HexToHash(strings.TrimSpace(hexHash))] = struct{}{}
+ }
+ return illegalCodeHashes
+}
+
// MakeSystemNode sets up a local node, configures the services to launch and
// assembles the P2P protocol stack.
func MakeSystemNode(name, version string, relconf release.Config, extra []byte, ctx *cli.Context) *node.Node {
@@ -676,6 +690,8 @@ func MakeSystemNode(name, version string, relconf release.Config, extra []byte,
}
// Configure the Ethereum service
accman := MakeAccountManager(ctx)
+ // parse the illegal code hashes and set them to the core package.
+ core.IllegalCodeHashes = ParseIllegalCodeHashes(ctx)
// initialise new random number generator
rand := rand.New(rand.NewSource(time.Now().UnixNano()))