diff --git a/core/types/transaction.go b/core/types/transaction.go index 653498a851..36865ce5de 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -195,6 +195,19 @@ func (tx *Transaction) To() *common.Address { return &to } +func (tx *Transaction) From() *common.Address { + if tx.data.V != nil { + signer := deriveSigner(tx.data.V) + if f, err := Sender(signer, tx); err != nil { + return nil + } else { + return &f + } + } else { + return nil + } +} + // Hash hashes the RLP encoding of tx. // It uniquely identifies the transaction. func (tx *Transaction) Hash() common.Hash { @@ -274,6 +287,13 @@ func (tx *Transaction) IsSpecialTransaction() bool { return tx.To().String() == common.RandomizeSMC || tx.To().String() == common.BlockSigners } +func (tx *Transaction) IsSigningTransaction() bool { + if tx.To() == nil { + return false + } + return tx.To().String() == common.BlockSigners +} + func (tx *Transaction) String() string { var from, to string if tx.data.V != nil { @@ -505,4 +525,4 @@ func (m Message) Value() *big.Int { return m.amount } func (m Message) Gas() uint64 { return m.gasLimit } func (m Message) Nonce() uint64 { return m.nonce } func (m Message) Data() []byte { return m.data } -func (m Message) CheckNonce() bool { return m.checkNonce } +func (m Message) CheckNonce() bool { return m.checkNonce } \ No newline at end of file