From 110a55012a0cb29694157723535bbcf5142b671c Mon Sep 17 00:00:00 2001
From: Determinant <tederminant@gmail.com>
Date: Sun, 28 Jun 2020 00:37:28 -0400
Subject: change zero addr to 0x0 (from 0x1000...0) with backward-compatibility

---
 plugin/evm/vm.go | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

(limited to 'plugin/evm')

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{
-- 
cgit v1.2.3-70-g09d2