rpc: extract sender address from msg signature (#217)

* extract real from address in rpc tx query api

Closes: #210

* Update x/evm/types/msg.go

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
yihuang
2021-07-02 09:34:15 +00:00
committed by GitHub
co-authored by Federico Kunze Küllmer
parent 6e983a9da1
commit e6f1874cfc
4 changed files with 32 additions and 6 deletions
+9 -2
View File
@@ -723,9 +723,13 @@ func (e *PublicAPI) GetTransactionByHash(hash common.Hash) (*rpctypes.RPCTransac
return nil, fmt.Errorf("invalid tx type: %T", tx)
}
from, err := msg.GetSender(e.chainIDEpoch)
if err != nil {
return nil, err
}
return rpctypes.NewTransactionFromData(
msg.Data,
common.HexToAddress(msg.From),
from,
hash,
common.BytesToHash(resBlock.Block.Hash()),
uint64(res.Height),
@@ -880,7 +884,10 @@ func (e *PublicAPI) GetTransactionReceipt(hash common.Hash) (map[string]interfac
status = hexutil.Uint(ethtypes.ReceiptStatusFailed)
}
from := common.HexToAddress(msg.From)
from, err := msg.GetSender(e.chainIDEpoch)
if err != nil {
return nil, err
}
resLogs, err := e.queryClient.TxLogs(e.ctx, &evmtypes.QueryTxLogsRequest{Hash: hash.Hex()})
if err != nil {