diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-05-08 17:37:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-08 17:37:01 +0800 |
commit | d18b509e40c5d41a9ab25cd23c282b7502ff1f2a (patch) | |
tree | 034a4158f83dc0b0195b4aef86a4efe1cfe01db8 | |
parent | 2e4d23a7934a31cb7e65dce5bb975339be964e1f (diff) | |
parent | 60293820b7577a83c77a55038f14b555c3d9a3ff (diff) | |
download | go-tangerine-d18b509e40c5d41a9ab25cd23c282b7502ff1f2a.tar.gz go-tangerine-d18b509e40c5d41a9ab25cd23c282b7502ff1f2a.tar.zst go-tangerine-d18b509e40c5d41a9ab25cd23c282b7502ff1f2a.zip |
Merge pull request #14441 from karalabe/receipt-data-regression
core: fix processing regression during receipt import
-rw-r--r-- | core/blockchain.go | 7 | ||||
-rw-r--r-- | core/state_transition.go | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/core/blockchain.go b/core/blockchain.go index cab923bca..794e1915f 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -665,10 +665,11 @@ func SetReceiptsData(config *params.ChainConfig, block *types.Block, receipts ty // The transaction hash can be retrieved from the transaction itself receipts[j].TxHash = transactions[j].Hash() - tx, _ := transactions[j].AsMessage(signer) // The contract address can be derived from the transaction itself - if MessageCreatesContract(tx) { - receipts[j].ContractAddress = crypto.CreateAddress(tx.From(), tx.Nonce()) + if transactions[j].To() == nil { + // Deriving the signer is expensive, only do if it's actually needed + from, _ := types.Sender(signer, transactions[j]) + receipts[j].ContractAddress = crypto.CreateAddress(from, transactions[j].Nonce()) } // The used gas can be calculated based on previous receipts if j == 0 { diff --git a/core/state_transition.go b/core/state_transition.go index 9e11144c6..ea773b801 100644 --- a/core/state_transition.go +++ b/core/state_transition.go @@ -78,10 +78,6 @@ type Message interface { Data() []byte } -func MessageCreatesContract(msg Message) bool { - return msg.To() == nil -} - // IntrinsicGas computes the 'intrinsic gas' for a message // with the given data. // @@ -220,7 +216,7 @@ func (self *StateTransition) TransitionDb() (ret []byte, requiredGas, usedGas *b sender := self.from() // err checked in preCheck homestead := self.evm.ChainConfig().IsHomestead(self.evm.BlockNumber) - contractCreation := MessageCreatesContract(msg) + contractCreation := msg.To() == nil // Pay intrinsic gas // TODO convert to uint64 intrinsicGas := IntrinsicGas(self.data, contractCreation, homestead) |