From b1b52e794834f2f5237a9c7efdd1d6a407a1ef93 Mon Sep 17 00:00:00 2001 From: shreekara shastry <66725577+shreekarashastry@users.noreply.github.com> Date: Fri, 25 Feb 2022 19:53:21 -0600 Subject: [PATCH] Enabling contract deployment (#197) * Enabling contract deployment --- core/types/transaction.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index 9b0f64feee..88d5a68872 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -619,9 +619,13 @@ func (tx *Transaction) AsMessage(s Signer, baseFee *big.Int) (Message, error) { idRange := params.LookupChainIDRange(s.ChainID()) sendingFromExternal := int(msg.from[0]) < idRange[0] || int(msg.from[0]) > idRange[1] - sendingToInternal := int(tx.To()[0]) >= idRange[0] && int(tx.To()[0]) <= idRange[1] - if sendingFromExternal && sendingToInternal { - msg.fromExternal = true + + // checking if the transaction is deploying a contract + if tx.To() != nil && tx.Data() == nil { + sendingToInternal := int(tx.To()[0]) >= idRange[0] && int(tx.To()[0]) <= idRange[1] + if sendingFromExternal && sendingToInternal { + msg.fromExternal = true + } } return msg, err