diff --git a/core/types/eth_transaction.go b/core/types/eth_transaction.go index 38126eefa..77b721880 100644 --- a/core/types/eth_transaction.go +++ b/core/types/eth_transaction.go @@ -21,6 +21,8 @@ import ( "math/big" "sync/atomic" + "github.com/harmony-one/harmony/internal/params" + "github.com/ethereum/go-ethereum/common/hexutil" nodeconfig "github.com/harmony-one/harmony/internal/configs/node" @@ -333,7 +335,7 @@ func (tx *EthTransaction) SenderAddress() (common.Address, error) { // IsEthCompatible returns whether the txn is ethereum compatible func (tx *EthTransaction) IsEthCompatible() bool { - return true + return params.IsEthCompatible(tx.ChainID()) } // AsMessage returns the transaction as a core.Message. diff --git a/rpc/eth/types.go b/rpc/eth/types.go index 84a4b466b..3dc68d21c 100644 --- a/rpc/eth/types.go +++ b/rpc/eth/types.go @@ -77,7 +77,13 @@ func NewTransaction( tx *types.EthTransaction, blockHash common.Hash, blockNumber uint64, timestamp uint64, index uint64, ) (*Transaction, error) { - from, err := tx.SenderAddress() + from := common.Address{} + var err error + if tx.IsEthCompatible() { + from, err = tx.SenderAddress() + } else { + from, err = tx.ConvertToHmy().SenderAddress() + } if err != nil { return nil, err }