Skip to content

Commit

Permalink
eth, internal/ethapi: fix lint
Browse files Browse the repository at this point in the history
(cherry picked from commit c867cce)

# Conflicts:
#	eth/api.go
#	internal/ethapi/api.go
  • Loading branch information
CaraWang committed Dec 19, 2023
1 parent 3b521cd commit 44ef009
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion eth/api_debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ func (api *DebugAPI) GetAccessibleState(from, to rpc.BlockNumber) (uint64, error
func (api *DebugAPI) GetBlockReceipts(blockHash common.Hash) ([]map[string]interface{}, error) {
if receipts := api.eth.blockchain.GetReceiptsByHash(blockHash); receipts != nil {
if block := api.eth.blockchain.GetBlockByHash(blockHash); block != nil {
return ethapi.ToTxReceipts(block.Header().Number.Uint64(), blockHash, receipts, block)
return ethapi.ToTxReceipts(api.eth.APIBackend.ChainConfig(), block.Header().Number.Uint64(), blockHash, receipts, block)
}
}
return nil, errors.New("unknown receipts")
Expand Down
7 changes: 3 additions & 4 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2013,11 +2013,10 @@ func (s *TransactionAPI) GetTransactionReceiptsByBlockNumber(ctx context.Context
return nil, fmt.Errorf("block %d not found", blockNumber)
}

return ToTxReceipts(blockNumber, blockHash, receipts, block)
return ToTxReceipts(s.b.ChainConfig(), blockNumber, blockHash, receipts, block)
}

func ToTxReceipts(blockNumber uint64, blockHash common.Hash, receipts types.Receipts, block *types.Block) ([]map[string]interface{}, error) {

func ToTxReceipts(config *params.ChainConfig, blockNumber uint64, blockHash common.Hash, receipts types.Receipts, block *types.Block) ([]map[string]interface{}, error) {
txs := block.Transactions()
if len(txs) != len(receipts) {
return nil, fmt.Errorf("txs length doesn't equal to receipts' length")
Expand All @@ -2026,7 +2025,7 @@ func ToTxReceipts(blockNumber uint64, blockHash common.Hash, receipts types.Rece
txReceipts := make([]map[string]interface{}, 0, len(txs))
for idx, receipt := range receipts {
tx := txs[idx]
signer := types.MakeSigner(s.b.ChainConfig(), block.Number(), block.Time())
signer := types.MakeSigner(config, block.Number(), block.Time())
from, _ := types.Sender(signer, tx)

fields := map[string]interface{}{
Expand Down

0 comments on commit 44ef009

Please sign in to comment.