From 24ce6a1262bd8e5f842705c305748cf9f8289937 Mon Sep 17 00:00:00 2001 From: Mo Lin Date: Fri, 12 Mar 2021 15:49:05 +0800 Subject: [PATCH] fix for chainId compare. --- VERSION | 2 +- core/types/transaction_signing.go | 2 +- params/config.go | 24 ++++++++++++++++++++++++ params/version.go | 8 ++++---- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index 828a2b15..bfb711af 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -2.1.10-beta +2.1.10-beta.1 diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index d6912a89..b970c842 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -138,7 +138,7 @@ func (s EIP155Signer) Sender(tx *Transaction) (common.Address, error) { return common.Address{}, ErrInvalidChainId } - if IsEthereumTx(tx.Txtype()) && tx.ChainId().Cmp(s.chainId) == 0 { + if IsEthereumTx(tx.Txtype()) && tx.ChainId().Cmp(s.chainId) == 0 && params.IsOldChainId(s.chainId.Uint64()) { return common.Address{}, ErrInvalidChainId } diff --git a/params/config.go b/params/config.go index e7b7eb78..797f5470 100644 --- a/params/config.go +++ b/params/config.go @@ -506,3 +506,27 @@ func JupiterChainId(chainId uint64) uint64 { return NOT_JUPITER_CHAIN_ID } + +func IsOldChainId(chainId uint64) bool { + if chainId == MAINNET_CHAIN_ID { + return true + } + + if chainId == TESTNET_CHAIN_ID { + return true + } + + if chainId == INTERNAL_CHAIN_ID { + return true + } + + if chainId == PLUTO_CHAIN_ID { + return true + } + + if chainId == PLUTODEV_CHAIN_ID { + return true + } + + return false +} diff --git a/params/version.go b/params/version.go index 538c4d3f..215b7e0a 100644 --- a/params/version.go +++ b/params/version.go @@ -21,10 +21,10 @@ import ( ) const ( - VersionMajor = 2 // Major version component of the current release - VersionMinor = 1 // Minor version component of the current release - VersionPatch = 10 // Patch version component of the current release - VersionMeta = "beta" // Version metadata to append to the version string + VersionMajor = 2 // Major version component of the current release + VersionMinor = 1 // Minor version component of the current release + VersionPatch = 10 // Patch version component of the current release + VersionMeta = "beta.1" // Version metadata to append to the version string ) // Version holds the textual version string.