Fix for getTransactionReceipt returning empty 'from' address. (#242)
* Fix for getTransactionReceipt returning empty 'from' address. * Unify the code * Unify the code
This commit is contained in:
parent
50b402cfaa
commit
77f861dd95
@ -604,10 +604,7 @@ func (pea *PublicEthAPI) localGetTransactionReceipt(ctx context.Context, hash co
|
|||||||
}
|
}
|
||||||
receipt := receipts[index]
|
receipt := receipts[index]
|
||||||
|
|
||||||
var signer types.Signer = types.FrontierSigner{}
|
signer := SignerForTx(tx)
|
||||||
if tx.Protected() {
|
|
||||||
signer = types.NewEIP155Signer(tx.ChainId())
|
|
||||||
}
|
|
||||||
from, _ := types.Sender(signer, tx)
|
from, _ := types.Sender(signer, tx)
|
||||||
|
|
||||||
fields := map[string]interface{}{
|
fields := map[string]interface{}{
|
||||||
|
@ -144,15 +144,21 @@ func NewRPCTransactionFromBlockHash(b *types.Block, hash common.Hash) *RPCTransa
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRPCTransaction returns a transaction that will serialize to the RPC
|
// SignerForTx returns an appropriate Signer for this Transaction
|
||||||
// representation, with the given location metadata set (if available).
|
func SignerForTx(tx *types.Transaction) types.Signer {
|
||||||
func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int) *RPCTransaction {
|
|
||||||
var signer types.Signer
|
var signer types.Signer
|
||||||
if tx.Protected() {
|
if tx.Protected() {
|
||||||
signer = types.LatestSignerForChainID(tx.ChainId())
|
signer = types.LatestSignerForChainID(tx.ChainId())
|
||||||
} else {
|
} else {
|
||||||
signer = types.HomesteadSigner{}
|
signer = types.HomesteadSigner{}
|
||||||
}
|
}
|
||||||
|
return signer
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewRPCTransaction returns a transaction that will serialize to the RPC
|
||||||
|
// representation, with the given location metadata set (if available).
|
||||||
|
func NewRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, index uint64, baseFee *big.Int) *RPCTransaction {
|
||||||
|
signer := SignerForTx(tx)
|
||||||
from, _ := types.Sender(signer, tx)
|
from, _ := types.Sender(signer, tx)
|
||||||
v, r, s := tx.RawSignatureValues()
|
v, r, s := tx.RawSignatureValues()
|
||||||
result := &RPCTransaction{
|
result := &RPCTransaction{
|
||||||
|
@ -243,10 +243,7 @@ func (t *Transaction) From(ctx context.Context, args BlockNumberArgs) (*Account,
|
|||||||
if err != nil || tx == nil {
|
if err != nil || tx == nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var signer types.Signer = types.HomesteadSigner{}
|
signer := eth.SignerForTx(tx)
|
||||||
if tx.Protected() {
|
|
||||||
signer = types.NewEIP155Signer(tx.ChainId())
|
|
||||||
}
|
|
||||||
from, _ := types.Sender(signer, tx)
|
from, _ := types.Sender(signer, tx)
|
||||||
|
|
||||||
return &Account{
|
return &Account{
|
||||||
|
Loading…
Reference in New Issue
Block a user