aboutsummaryrefslogtreecommitdiff
path: root/plugin/evm/vm.go
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2020-06-28 00:37:28 -0400
committerDeterminant <[email protected]>2020-06-28 00:37:28 -0400
commit110a55012a0cb29694157723535bbcf5142b671c (patch)
treec0a332b5152047e3c3b96ea6c24017087983cb60 /plugin/evm/vm.go
parente4f24f3cd168c63d211fb1e49f1745496d7a3437 (diff)
change zero addr to 0x0 (from 0x1000...0) with backward-compatibilityv0.2.7-rc.3
Diffstat (limited to 'plugin/evm/vm.go')
-rw-r--r--plugin/evm/vm.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/plugin/evm/vm.go b/plugin/evm/vm.go
index 24fe98c..db1f5a9 100644
--- a/plugin/evm/vm.go
+++ b/plugin/evm/vm.go
@@ -38,6 +38,14 @@ import (
commonEng "github.com/ava-labs/gecko/snow/engine/common"
)
+var (
+ oldZeroAddr = common.Address{
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+ zeroAddr = coreth.ZeroAddr
+)
+
const (
lastAcceptedKey = "snowman_lastAccepted"
)
@@ -138,7 +146,7 @@ func (vm *VM) Initialize(
panic(err)
}
nodecfg := node.Config{NoUSB: true}
- chain := coreth.NewETHChain(&config, &nodecfg, nil, vm.chaindb)
+ chain := coreth.NewETHChain(&config, &nodecfg, &zeroAddr, vm.chaindb)
vm.chain = chain
vm.networkID = config.NetworkId
chain.SetOnHeaderNew(func(header *types.Header) {
@@ -306,7 +314,9 @@ func (vm *VM) ParseBlock(b []byte) (snowman.Block, error) {
return nil, err
}
// Coinbase must be zero on C-Chain
- if bytes.Compare(ethBlock.Coinbase().Bytes(), coreth.ZeroAddr.Bytes()) != 0 {
+ coinbase := ethBlock.Coinbase()
+ if bytes.Compare(coinbase.Bytes(), oldZeroAddr.Bytes()) != 0 &&
+ bytes.Compare(coinbase.Bytes(), zeroAddr.Bytes()) != 0 {
return nil, errInvalidBlock
}
block := &Block{