From de8d73c083b7903d340cb4ec4df02c6296398c70 Mon Sep 17 00:00:00 2001 From: islishude Date: Mon, 17 Feb 2020 17:05:59 +0800 Subject: [PATCH] core/types: add From() helper function for Transaction --- core/types/transaction.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/types/transaction.go b/core/types/transaction.go index 3eb8df0ac7..efc75c76d2 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -189,6 +189,11 @@ func (tx *Transaction) To() *common.Address { return &to } +// From returns the sender address of the transaction +func (tx *Transaction) From() (common.Address, error) { + return NewEIP155Signer(tx.ChainId()).Sender(tx) +} + // Hash hashes the RLP encoding of tx. // It uniquely identifies the transaction. func (tx *Transaction) Hash() common.Hash {