diff options
author | Determinant <[email protected]> | 2020-06-28 00:37:28 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-06-28 00:37:28 -0400 |
commit | 110a55012a0cb29694157723535bbcf5142b671c (patch) | |
tree | c0a332b5152047e3c3b96ea6c24017087983cb60 | |
parent | e4f24f3cd168c63d211fb1e49f1745496d7a3437 (diff) |
change zero addr to 0x0 (from 0x1000...0) with backward-compatibilityv0.2.7-rc.3
-rw-r--r-- | coreth.go | 2 | ||||
-rw-r--r-- | plugin/evm/vm.go | 14 |
2 files changed, 13 insertions, 3 deletions
@@ -24,7 +24,7 @@ import ( var ( ZeroAddr = common.Address{ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, } ) 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{ |