fix: 2 APIs of get receipt related(#1950)

* fix: GetTransactionReceiptsByBlockNumber &  GetTransactionDataAndReceipt
This commit is contained in:
Eric 2023-10-30 13:38:47 +08:00 committed by GitHub
parent 3bf998f55c
commit 3e298c1586
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1983,10 +1983,7 @@ func (s *TransactionAPI) GetTransactionReceiptsByBlockNumber(ctx context.Context
txReceipts := make([]map[string]interface{}, 0, len(txs))
for idx, receipt := range receipts {
tx := txs[idx]
var signer types.Signer = types.FrontierSigner{}
if tx.Protected() {
signer = types.NewEIP155Signer(tx.ChainId())
}
signer := types.MakeSigner(s.b.ChainConfig(), block.Number(), block.Time())
from, _ := types.Sender(signer, tx)
fields := map[string]interface{}{
@ -2001,6 +1998,8 @@ func (s *TransactionAPI) GetTransactionReceiptsByBlockNumber(ctx context.Context
"contractAddress": nil,
"logs": receipt.Logs,
"logsBloom": receipt.Bloom,
"type": hexutil.Uint(tx.Type()),
"effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice),
}
// Assign receipt status or post state.
@ -2039,7 +2038,7 @@ func (s *TransactionAPI) GetTransactionDataAndReceipt(ctx context.Context, hash
receipt := receipts[index]
// Derive the sender.
header, err := s.b.HeaderByHash(ctx, hash)
header, err := s.b.HeaderByHash(ctx, blockHash)
if err != nil {
return nil, err
}
@ -2077,6 +2076,8 @@ func (s *TransactionAPI) GetTransactionDataAndReceipt(ctx context.Context, hash
"contractAddress": nil,
"logs": receipt.Logs,
"logsBloom": receipt.Bloom,
"type": hexutil.Uint(tx.Type()),
"effectiveGasPrice": (*hexutil.Big)(receipt.EffectiveGasPrice),
}
// Assign receipt status or post state.