From 423944bf799816b6db214fabebcf1b334d3b0826 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Mon, 13 Dec 2021 17:28:02 -0800 Subject: [PATCH] x/evm/types: use ethtypes.Transaction.To for cheaper retrieval (#835) Following suit with PR #828, this change cuts down the expenses from using .To doubly; yet using the Go in-condition variable idiom. Updates #826 --- x/evm/types/access_list_tx.go | 4 ++-- x/evm/types/dynamic_fee_tx.go | 4 ++-- x/evm/types/legacy_tx.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x/evm/types/access_list_tx.go b/x/evm/types/access_list_tx.go index b8187c21..edfa857b 100644 --- a/x/evm/types/access_list_tx.go +++ b/x/evm/types/access_list_tx.go @@ -18,8 +18,8 @@ func newAccessListTx(tx *ethtypes.Transaction) (*AccessListTx, error) { } v, r, s := tx.RawSignatureValues() - if tx.To() != nil { - txData.To = tx.To().Hex() + if to := tx.To(); to != nil { + txData.To = to.Hex() } if tx.Value() != nil { diff --git a/x/evm/types/dynamic_fee_tx.go b/x/evm/types/dynamic_fee_tx.go index 1e1bfacd..bc4f6ae7 100644 --- a/x/evm/types/dynamic_fee_tx.go +++ b/x/evm/types/dynamic_fee_tx.go @@ -20,8 +20,8 @@ func newDynamicFeeTx(tx *ethtypes.Transaction) (*DynamicFeeTx, error) { } v, r, s := tx.RawSignatureValues() - if tx.To() != nil { - txData.To = tx.To().Hex() + if to := tx.To(); to != nil { + txData.To = to.Hex() } if tx.Value() != nil { diff --git a/x/evm/types/legacy_tx.go b/x/evm/types/legacy_tx.go index 6a1cc4cf..888bd66f 100644 --- a/x/evm/types/legacy_tx.go +++ b/x/evm/types/legacy_tx.go @@ -17,8 +17,8 @@ func newLegacyTx(tx *ethtypes.Transaction) (*LegacyTx, error) { } v, r, s := tx.RawSignatureValues() - if tx.To() != nil { - txData.To = tx.To().Hex() + if to := tx.To(); to != nil { + txData.To = to.Hex() } if tx.Value() != nil {