This commit is contained in:
MestryOmkar 2018-11-24 17:57:32 +05:30
parent b0cfa3037f
commit 8eb3182487

View file

@ -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 }