Skip to content

Commit

Permalink
unsafe: optimise the memory allocation in Sender.Hash() and Transacti…
Browse files Browse the repository at this point in the history
…onToMessage()
  • Loading branch information
andyzhang2023 committed Aug 7, 2024
1 parent 1324f36 commit b969512
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions core/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In
msg := &Message{
Nonce: tx.Nonce(),
GasLimit: tx.Gas(),
GasPrice: new(big.Int).Set(tx.GasPrice()),
GasFeeCap: new(big.Int).Set(tx.GasFeeCap()),
GasTipCap: new(big.Int).Set(tx.GasTipCap()),
GasPrice: tx.GasPriceRef(),
GasFeeCap: tx.GasFeeCapRef(),
GasTipCap: tx.GasTipCapRef(),
To: tx.To(),
Value: tx.Value(),
Value: tx.ValueRef(),
Data: tx.Data(),
AccessList: tx.AccessList(),
IsSystemTx: tx.IsSystemTx(),
Expand Down
6 changes: 3 additions & 3 deletions core/types/transaction_signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ func (s londonSigner) Hash(tx *Transaction) common.Hash {
[]interface{}{
s.chainId,
tx.Nonce(),
tx.GasTipCap(),
tx.GasFeeCap(),
tx.GasTipCapRef(),
tx.GasFeeCapRef(),
tx.Gas(),
tx.To(),
tx.Value(),
tx.ValueRef(),
tx.Data(),
tx.AccessList(),
})
Expand Down

0 comments on commit b969512

Please sign in to comment.